Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Creating your first WSS/Sharepoint Web Part

In WSS 3.0, the creation of web parts is easier than ever.  Since WSS 3.0 is fully based on and built around ASP.Net 2.0 you can leverage the .net framework to do your heavy lifting.

Today I thought I would create a simple post on how to create your very first web part.  If you want a more in-depth how-to, please see the Links section below for more information.

Getting Started:

  1. Create a new VS 2005 project
  2. Reference the System.Web namespace in your project
  3. Create a new class and have it inherit off of WebPart
    public class SimpleWebPart : WebPart

  4. Override the Render class, add a add the following line
    writer.Write("Hello, my first web part");

  5. Compile your web part.
  6. Copy your webpart to the bin directory on your WSS web server found here on my server
    C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin

  7. Open the web.config file to change the trust level of the site to WSS_Medium
  8. Add your assembly to the SafeControl list (I would copy an existing one and modify it)
    NOTE *** If you have not signed your assembly you can remove the PublicKeyToken attribute ***

  9. Open up a web browser and navigate to http://<<YourServerNameHere>>/_layouts/newdwp.aspx
    If you made the correct settings to the Web.Config file you should see your webpart in the list.

  10. Select your new web part and click Populate Gallery.  This will create the needed config file for your webpart.
  11. Now go to your sharepoint site and add the new web part.
    • Open a WSS list in edit mode
    • Click add web part
    • Select your new web part and add it to the list.

    12  Enjoy your new web part.


I know this is just the tip of the ice berg, but you have got to start someplace.

Links

  • More In-depth how-to - here
  • Web Part Control Set Overview - here
  • Creating web parts in WSS - here

Till next time,

kick it on DotNetKicks.com

Posted 08-13-2007 7:50 AM by Derik Whittaker
Filed under: ,

[Advertisement]

Comments

Choop wrote re: Creating your first WSS/Sharepoint Web Part
on 08-30-2007 4:33 AM

You can find more info in: http://www.kwizcom.com.

With some more cool stuff.. like sharepoint calendar or sharepoint  offline solutions.

sara wrote re: Creating your first WSS/Sharepoint Web Part
on 10-01-2009 5:19 AM

Nice !!!!!!!!

<b>Create Custom SharePoint WebParts, it is simple.</b>

Try this too,

<a href ="sarangasl.blogspot.com/.../in-this-article-im-going-to-describe.html">Custom SharePoint WebParts</a>

sarangasl wrote re: Creating your first WSS/Sharepoint Web Part
on 10-01-2009 5:22 AM

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)