Tech Talk PT

Create a Sharepoint 2007 webpart step by step

Mart Muller's on his weblog has written an article were he describes step by step the creation of a webpart in Sahrepoint 2007:

 . . .Before I describe those detailed steps, there are a few things that you have to keep in mind:

Ok, with this in mind we will go through the steps to take you first SharePoint 2007 webpart:

Now, the webpart can be build. There are however two ways to deploy the dll in the sharepoint environment: using the ‘bin’ of the ‘GAC’. In this example we choose the Global Assembly Cache. Therefore, the assembly must be strongly named, which is very easy to do in VS.Net 2005.

To let SharePoint know that the assembly is safe, we have to add it to the safe control list in the web.config of the SharePoint web. We need the public key token from the DLL for this.

New in SharePoint 2007 is that once a dll is registered in the web.config, SharePoint can automatically detect webparts from those dll’s. With the site settings page, we can now automatically populate the webpart gallery.

Now, we can go the the page in SharePoint where we want to add the web part.

If everything had gone well, the webpart is there!

Creating webparts like descibed above is very basic. There will be some tools available to make things a lot easier. One of those tools is ‘Visual Studio Extensions for SharePoint Services’.

NOTE: this example is based on Office SharePoint Server 2007 Beta 1 TR. Things can change in other versions. Example is made on a Virtual Server with SharePoint 2007 installed including Visual Studio 2005.

 You can find this article here.