Wednesday, May 12, 2010

Sharepoint 8 - Some Useful Webpart from Codeplex

1. Forum:

http://spforums.codeplex.com/releases/view/53

The installation instruction in wss 3.0 is:

Until we get the WSS 3.0/MOSS version available to you, ProgramPhases.com has put together an excellent article on setting up the web part on WSS 3.0.

You can find their instructions here on the site.

Here are the steps reproduced in case the site isn't available. I haven't verified these to work but some people say it does. HTH.


Installing Sharepoint Forums 1.2 support in WSS3 includes the following steps:

Install ASP.NET AJAX 1.0 for WSS3
Download and Install Sharepoint Forums 1.2
Add Custom JavaScript Code to the default.master Page
Add the Sharepoint Forums 1.2 Web Part to a Sharepoint Page
The instructions for installing ASP.NET AJAX 1.0 support in WSS3 can be found here.

Download the latest version of the forums from the releases tab here.

After downloading Sharepoint Forums 1.2, install using the provided setup program.

Open a command prompt and run the following command from the
C:\Program Files\WPPackager\{14aa60ab-2b6b-4254-b45e-0ef7b8b2a201} folder:

stsadm.exe -o addwppack -filename "SharePointForums-1.2.0.0_Bil Simser.cab" -globalinstall -force

Edit the default.master file using Office Sharepoint Designer 2007. Put following JavaScript code immediately before the ending < /body> tag in the file.

< script type="text/javascript">
function ProcessOwsForm(ctl, argument)
{

if (frm.fPreviewMode)
{
var LcantSaveText = "This form cannot be saved when previewing this page.";
window.alert(LcantSaveText);
return;
}
if (frm.FValidate(true))
{
frm.FPostProcess();
var theForm = document.forms['aspnetForm'];
__doPostBack2(ctl, argument);
}
}
function __doPostBack2(eventTarget, eventArgument)
{
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
< /script>


2. List Form

http://officetoolbox.codeplex.com/releases/view/15713

Download OfficeToolbox.SharePoint.Lists v1.0 from Codeplex or at SharePoint Toolbox at MSDN Code. Unzip the archive and run Setup.exe on your Server box where you want to install or try. Go to "Central Admin > Application Management > Manage Web Application Features" and activate the Feature.

3. Filtered Lookup
http://filteredlookup.codeplex.com/

Thursday, May 6, 2010

Sharepoint 7 - Retrieve URL from SPListItem

Use the following:

SPFieldUrlValue fieldValue=new SPFieldUrlValue(myItem["URL"].ToString());
string LinkDescription=fieldValue.Description;
string LinkUrl=field.Url;

Tuesday, May 4, 2010

Sharepoint 6 - Web Part Verbs

We need to override the Verbs property of Web Part, change the following code:
public override WebPartVerbCollection Verbs
{
get
{
return base.Verbs;
}
}

Change the code to be like

public override WebPartVerbCollection Verbs
{
get
{
List< WebPartVerb> newVerbs=new List< WebPartVerb>();
WebPartVerb verb1=new WebPartVerb(this.ID+"verb1", new WebPartEventHandler(ServerSideHandler));
verb1.Text="....";
verb1.Visible=true;
verb1.Description="....verb1";
newVerbs.Add(verb1);

WebPartVerb verb2=new WebPartVerb(this.ID+"verb2","alert('verb2');");
verb.Text="...";
...
newVerbs.Add(verb2);

WebPartVerbCollection myVerbs=new WebPartVerbCollection(base.Verbs, newVerbs);
return myVerbs;



}
}
public void ServerSideVerbHandler(object sender, WebPartEventArgs e){...}