Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Developing Web Parts for SharePoint Portal Server 2003 in .NET

This article provides a step-by-step introduction to developing Web Parts using Visual Studio .NET by showing you how to build both simple and complex Web Part components. Along the way, you'll see how to debug Web Parts both locally and remotely—and learn a few tricks and tips.


advertisement
harePoint allows information workers to create powerful personalized interfaces by simply dragging and dropping pre-defined Web Part Components. Web Parts are components that enable non programmers to gather information they care about and customize the appearance of Web pages. For example, one Web Part might display a user's appointment calendar; another might create a graph showing current sales figures; and a third might show a list of new business topics, each of which functions as a link to a video or audio presentation. Developers can create these Web Part components and make them available to SharePoint users, letting them build customizable pages that meet their needs. This article shows you how to build and consume a simple Web Part. Web Part Templates for Visual Studio .NET
Web Parts are standard ASP.NET custom controls, but Microsoft has provided a new template that simplifies the process of creating Web Parts. You can download the template here .

You need to install the template only once, after which it will be available permanently in the Visual Studio .NET environment. Installing the Web Part Template.
After downloading the template, locate the file WebPartTemplates.exe, and double click on it to install the templates. The templates support both C# and VB.NET development—choose the target language or languages that fit your requirements. (see Figure 1)

 
Figure 1: During the Web Part template installation, you can elect to install the templates for either Visual C#, Visual Basic .NET, or both.

After selecting the Web Parts templates language, you'll need to select the location of the Microsoft.SharePoint.dll file. By default, SharePoint installs the Microsoft.SharePoint.dll to local_drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\ISAPI; however, you may have installed SharePoint to a non-default location. When you're developing locally with Visual Studio .NET, the .NET Framework, and SharePoint installed on same machine, you can simply provide the path to the local copy of the DLL. On the other hand, if you're developing on a local machine and connecting to a remote server hosting SharePoint, you'll find it easier to copy the DLL to your local machine and use that local DLL location. This article assumes that you're developing on a machine with both .NET and SharePoint installed locally (see Figure 2).


 
Figure 2: When asked to specify the Microsoft.SharePoint.dll path, provide the full path, but not the file name.

After installing the templates, every time you create a new Web Part application, Visual Studio will automatically add a reference to the SharePoint DLL to the Web Part project (see Figure 3).
 
Figure 3: The Solution Explorer in Visual Studio .NET after adding the Microsoft.SharePoint.dll reference.

On the other hand, if you don't provide the location for the DLL during installation, VS .NET pops up the following message every time you create a new Web Part application (see Figure 4).

 
Figure 4: You'll see this message if you don't specify the correct Sharepoing.dll location during installation.

Despite the message text, all that really means is that you'll have to add a reference to the DLL manually.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date