Wednesday, February 01, 2006 10:59 AM Jan Tielens

SharePoint Web Part Code Snippets for VS 2005

When you want to develop web parts for SharePoint the “traditional” way, it’s good idea to use the Web Part Templates for Visual Studio .NET. These templates will give you a start class to quickly build web parts. Unfortunately these templates are not (yet?) available for Visual Studio 2005. Since Windows SharePoint Services SP2 you can run your WSS sites on .NET 2.0, so you can build your SharePoint web parts with Visual Studio 2005. Given that copy/pasting code is rather cumbersome I’ve create a couple of code snippets for Visual Studio 2005 that will generate code for a SharePoint Web Part. Currently I’ve got code snippets to create:

  • C# Web Part (shortcut wp)
  • C# Web Part Property (shortcut wpprop)
  • C# Tool Part (shortcut tp)

I’m still working on the other items (provider and consumer web part) and the VB.NET versions (any volunteers?). You can download them from the GotDotNet site (http://workspaces.gotdotnet.com/webpartcodesnippets), the ZIP contains a VSI package so you can easily install them in VS 2005. (Make sure you select the code snippets you want to install, see screenshot)

Filed under:

Comments

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, February 01, 2006 6:47 AM by Remco Ploeg

Jan, Great files. How do you compile your webparts from vs 2005 to 1.1 framework? Do you use MSBuild?

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, February 01, 2006 6:56 AM by Jan Tielens

You don't have to compile to .NET 1.1 if WSS is running on ASP.NET 2.0. Just create class lib. project, add references to System.Web and Microsoft.SharePoint.dll, and use the snippets. Then compile in VS2005 and deploy like you would do for 1.1 web parts.

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, February 01, 2006 2:12 PM by timh

would love to see you post these individual snippets on http://www.gotcodesnippets.net

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, February 03, 2006 12:34 PM by Lindusia

Are there any examples of displaying an ASP.NET 2.0 web part in SharePoint using Son of SmartPart? I've found lots of examples of displaying user controls but none using the Son of SmarPart WP.

Also, can Son of SmartPart display custom ASP.NET 2.0 web parts that inherit from the WebPart class (NOT SharePoint web parts created in Visual Studio 2005 and extending from the SharePoint dll)?

Any help is GREATLY APPRECIATED!!

# re: SharePoint Web Part Code Snippets for VS 2005

Sunday, February 05, 2006 11:04 AM by Jonathan Yong

I have posted a WP C# project template for VS 2005.

http://workspaces.gotdotnet.com/jywss

# re: SharePoint Web Part Code Snippets for VS 2005

Sunday, February 05, 2006 5:47 PM by Yazan Khasawneh

Great job man, this is really nice thanks :).

# re: SharePoint Web Part Code Snippets for VS 2005

Sunday, February 05, 2006 7:36 PM by Shane Perran

Very nice :)

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, February 10, 2006 9:10 AM by Mark Vogt

Greetings Jan & other esteemed Sharepoint WP Developers,

Per usual, kudos to Jan for his snippets, and continued trailblazing for us.

Say, does anyone know if it's possible to use VS.NET C# Express Edition 2005 to develop web parts for a .NET Framework 1.1 environment?

My current engagement is for a very large corporation - the kind that take years to adopt a new change like .NET1.1 - to - .NET 2.0 upgrades. I'll be developing custom web parts for .NET1.1 for at least the next year - but I WANT to do it inside a new version of VS.NET C# Express Edition 2005 (because it's new & has a modest laptop install footprint).

Does anyone know if this is even possible, or must I continue to use VS.NET 2003 EA Edition for developing .NET 1.1 - compatible web parts?

Any info is most welcome.

Cheers,
Mark Vogt.Sharepoint Consultant.VOGTLAND.mark.vogt@vogtland.ws

# SharePoint Web Parts: Free 3rd Party SharePoint Web Parts & Tools

Thursday, June 01, 2006 4:44 PM by The Boiler Room - Mark Kruger, SharePoint MVP

For those who aggregate my feed and do not often visit the blog iteself... I've updated my SharePoint...

# re: SharePoint Web Part Code Snippets for VS 2005

Thursday, June 29, 2006 1:50 AM by Rickey Whitworth

I get an error message when installing that says String Cannot Have Zero Length. Any ideas?

Also, did you ever have any takers on the vb.net version? The smart part spoiled me on using the designer for sharepoint web parts (it was wonderful), and now that i am designing them for wss v3, I can't find a good way to do this.

Are you going to do a Smart Part for wss v3?

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, July 29, 2006 5:19 AM by SS

I have downloaded the snippet ..but don't know how to use it.Please Help..

# re: SharePoint Web Part Code Snippets for VS 2005

Thursday, September 21, 2006 4:26 PM by Thanks

Thanks to you my problem solved

# re: SharePoint Web Part Code Snippets for VS 2005

Tuesday, September 26, 2006 1:52 AM by ambily

Hi,

i wanted to develop web parts in visual studio 2005.i am using web part manager for that.but when i run application i get error:-"localsql server was not registered"

can anyone help me.

thanks in advance

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, March 02, 2007 4:20 AM by DumbGirl

What do u do after downloading and installing these files

how do i get the web part

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, March 07, 2007 2:14 AM by amar

im using VS.NET 2005 and WSS 3.0. What do i need to have to install Web Part Templates for VS.NET 2005 so that they can be used in WSS 3.0

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, March 16, 2007 6:36 PM by Dragan Panjkov

Same question as Amar...

but extended: I have VS on my machine and MOSS on my VM. I would like to create web parts for MOSS 2007 on my machine but I cannot install Visual Studio 2005 extensions for Windows SharePoint Services 3.0 on it because it is WinXP and WSS is not installed on it :(

Any workarounds for this?

# re: SharePoint Web Part Code Snippets for VS 2005

Tuesday, March 20, 2007 6:35 AM by Lincy Joseph

Great work, really  nice

# re: SharePoint Web Part Code Snippets for VS 2005

Monday, March 26, 2007 10:22 AM by Kristoffer Lindahl

I have the same problem as Dragan. Im running windows XP with Visual Studio 2005, and M$ wont let me install the studio extensions because im not running windows server 2003. is it actually supposed to be this way ? a requirement to run windows server 2003 to be able to develop for sharepoint services ?

# re: SharePoint Web Part Code Snippets for VS 2005

Monday, April 02, 2007 7:59 AM by ajk

I have the same issue as Mark Vogt,

http://weblogs.asp.net/jan/archive/2006/02/01/437037.aspx#437891

anyone know how to switch ASP.NET version of the VS2005 or maybe any other solution.

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, April 13, 2007 12:17 AM by Mercury

I'm kind of in shock that this download is not available for XP boxes. This appears to me to be a serious limitation. It seems Microsoft's recommendation is to set up a virtual machine with Windows Server 3.0 and WSS 3.0. This is a lot of time to spend to get a tool that's supposed to make life more convenient.

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, April 21, 2007 5:16 PM by Aiakos

interesting

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, April 21, 2007 5:57 PM by ekkis

I downloaded the snippets and ran the install... the final installation window indicates that the Web Part and Tool Part were skipped... how come?

# re: SharePoint Web Part Code Snippets for VS 2005

Sunday, April 22, 2007 1:07 PM by Leonidas

Nice...

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, April 28, 2007 11:42 PM by Yannis

Cool}Cool!

# re: SharePoint Web Part Code Snippets for VS 2005

Monday, April 30, 2007 11:17 AM by Charalambos

Sorry :(

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, May 12, 2007 5:02 PM by Sebastianos

Cool.

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, May 23, 2007 7:19 AM by Kiran

i got the same problem as Dragan.i could not able to install web part templates on my system(windows xp).plz let me know how to develop web parts using web part templates in vs 2005

# re: SharePoint Web Part Code Snippets for VS 2005

Tuesday, May 29, 2007 10:21 AM by evald

i have download ad installed the code snippet.

the problem is that i dont see it when i create a new project !

can you please help me ?

regards

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, June 06, 2007 11:42 AM by Aniketos

Nice...

# re: SharePoint Web Part Code Snippets for VS 2005

Thursday, June 07, 2007 1:32 AM by amit bansal

same problem.......

i have download ad installed the code snippet.

the problem is that i dont see it when i create a new project !

can you please help me ?

regards

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, June 08, 2007 9:53 PM by Costas

Cool!

# re: SharePoint Web Part Code Snippets for VS 2005

Monday, June 11, 2007 12:38 PM by Kostantinos

Cool!

# Free SharePoint Web Parts (3rd Party)

Wednesday, June 27, 2007 9:35 AM by The Boiler Room - Mark Kruger, Microsoft SharePoint MVP

Free SharePoint Web Parts (3rd Party) Konrad Brunner - UGS's Web Parts (broken link 8/25) Document

# re: SharePoint Web Part Code Snippets for VS 2005

Friday, July 13, 2007 2:08 PM by George

I was not able to download the zip file as GotDotNet site is being phrase out. Could you please re-post it to a place I can fetch? Thanks!

# re: SharePoint Web Part Code Snippets for VS 2005

Tuesday, September 11, 2007 8:29 AM by Common man

I was not able to download the zip file as GotDotNet site is being phased out or I could not figure out its location.

Can you plz provide another location. Thanks!!!!!!!!!!

# re: SharePoint Web Part Code Snippets for VS 2005

Saturday, September 22, 2007 3:34 PM by Mat

I have just found your blog and am very interested but MS has phased out the dot net repository so please supply an alternative :-)

# re: SharePoint Web Part Code Snippets for VS 2005

Wednesday, September 26, 2007 9:57 PM by Ric

So are we just a$$ out since the GotDamnNet site is Tango Uniform?

Does anyone care?

# re: SharePoint Web Part Code Snippets for VS 2005

Thursday, December 13, 2007 9:31 PM by Adrian

I care!

But somehow I don't think this would work in my environment here, since my Visual Studio is on my XP desktop machine, and not on the SharePoint server machine. I believe that those people having problems with not being able to create a new WebPart project or whatever, I heard that to build WebParts you have to be using Visual Studio on the same machine that SharePoint server is on. Please correct me if I'm wrong... (I'd really like to be able to develop the WebParts on my XP box!!)

-Adrian

# re: SharePoint Web Part Code Snippets for VS 2005

Thursday, December 20, 2007 1:33 PM by Chris

I am trying to use a web part to grab the credentials that a user has entered SharePoint with to pass them to a web page that accept FORM/POST login input.  Any idea how I would do that?

Chris

# WSS 3.0 & MOSS: Web Parts for free a tutiplen!

Tuesday, July 15, 2008 4:19 PM by Blog del CIIN

Qué SharePoint está de moda es algo que está más que claro, que hay un montón de gente trabajando en

# WSS 3.0 & MOSS: Web Parts for free a tutiplen! « Pasi??n por la tecnolog??a…

Pingback from  WSS 3.0 & MOSS: Web Parts for free a tutiplen! « Pasi??n por la tecnolog??a…

# Free SharePoint Web Parts « Prashant Jadhav : Microsoft Sharepoint, Web 2.0, Elearning, MLearning

Pingback from  Free SharePoint Web Parts « Prashant Jadhav : Microsoft Sharepoint, Web 2.0, Elearning, MLearning

# sviluppo web part con VS 2005 | hilpers

Wednesday, January 21, 2009 9:59 AM by sviluppo web part con VS 2005 | hilpers

Pingback from  sviluppo web part con VS 2005 | hilpers