There are plenty of guides out there detailing how to create a new Windows SharePoint Services v3 web part, so I won't write another one here. Those walkthroughs are great, but sometimes I just want a quick outline of the steps needed to get things done. So while creating my own web part, I kept track of the steps and created my own simple outline. Here it for your use:
- Create the Web Part
- Create the DLL project in VS2005.
- Add Reference to
System.Web.dll.
- Create a new Class file, inherit from
System.Web.UI.WebControl.WebParts.
- Override the
Render method and use writer to output the content of the web part.
- Strong name the assembly if installing to GAC.
- Compile.
- Deploy Web Part (updated 11/2/06 with B2TR)
- For strong named assemblies, follow these steps:
- Copy your assemblies to the
C:\Inetpub\wwwroot\wss\VirtualDirectories\[site directory guid]\bin folder or install to the GAC. Note assemblies in the \bin folder have less priviledges than those in the GAC. Test your web part to make sure there aren't any security problems.
- Modify the site's
web.config and add a <SafeControl> entry. Should look something like:
<SafeControl Assembly="[Web_Part_Assembly_Name], Version=[Version_Number], Culture=neutral, PublicKeyToken=[Public_Key]" Namespace="[Namespace]" TypeName="[Class_Name]" Safe="True" />
- For non-strong named assemblies, follow these steps:
- Copy your assemblies to
C:\Inetpub\wwwroot\wss\VirtualDirectories\[site directory guid]\bin folder.
- Modify the site's
web.config and add a <SafeControl> entry. Should look something like:
<SafeControl Assembly="[Web_Part_Assembly_Name]" Namespace="[Namespace]" TypeName="[Class_Name]" Safe="True" />
- Configure the Web Part in SharePoint
- Go to Site Settings, Galleries, Web Parts, click New.
- Select your web part and click Populate Gallery button. Make sure the web part now shows up in the web parts gallery. If the web part doesn't show up in the list of New Web Parts, may need to
iisreset.
- Edit a page and add your web part in from the Gallery.
Note that these steps are for WSS v3 Beta 2. These steps may change at RTM. I'll try to keep this up to date if things change.
For more detailed walkthroughs of how to create ASP.NET 2.0 style web parts for WSS v3, here are some resources/links: