Web Part Templates for Microsoft Visual Studio .NET

 

Suraj Poozhiyil
Microsoft Corporation

March 2003

Applies to:
    Microsoft® Windows® SharePoint™ Services and Web Parts
    Microsoft Visual Studio® .NET

Summary: Learn how to install and use the Web Part templates for Visual Studio .NET. Use these templates to create Web Part libraries containing Web Parts and Tool Parts for Windows SharePoint Services. (4 printed pages)

Download WebPartTemplatesforVSNetSample2.EXE.

Contents

Introduction
System Requirements
Installing the Web Part Template Package
Creating a Simple Web Part Library Project
Adding a New File to a Web Part Library Project
Conclusion

Introduction

Web Part developers can use Microsoft® Visual Studio® .NET to build Web Part assemblies for use in Microsoft SharePoint™ Products and Technologies. These templates are provided to help developers create Web Parts. The templates are similar to the default server control file and project templates included with Visual Studio .NET.

Before using these templates, developers should be familiar with he following:

  • Microsoft Windows® SharePoint Services and its features
  • The Web Part architecture as it applies to Windows SharePoint Services

For more information about developing Web Parts for SharePoint Products and Technologies, see the Microsoft SharePoint Products and Technologies software development kit (SDK).

System Requirements

To create a Web Part assembly, you must meet the following minimum requirements:

  • Access to the Microsoft Windows SharePoint Services assembly
  • Sufficient permissions to install the template package and create Visual Studio projects
  • Meet all the requirements for Visual Studio .NET

Installing the Web Part Template Package

This section explains how to install the Web Part templates for Visual Studio, how to add a reference to the Windows SharePoint Services assembly, and how to prepare Visual Studio to use the templates.

  1. Download Web Part Templates for Visual Studio .NET by clicking on the download link. A dialog box appears, allowing you to view the End-User License Agreement (EULA) that is associated with the template package.

    Note   You must accept the EULA to successfully download the package.

  2. When prompted, do one of the following:

    • Click Open to install the package. The Setup Wizard starts.

      Note   If a security alert appears, choose to trust content only if the source of the file is Microsoft.

    • Click Save to save a copy, and then type the location on the local files system to save the package. After the download is complete, locate the downloaded file and double-click Setup to start the Setup Wizard.

  3. The Setup Wizard starts. Click Next to install the package.

  4. Select the programming languages for which you want to install the templates and then click Next.

    Note   By default, the Setup Wizard installs C# Web Part Templates and Microsoft Visual Basic Web Part Templates.

  5. In the text box provided, type the location of the Windows SharePoint Services assembly in the file system and click Next.

    Note   If Windows SharePoint Services is installed on your machine, the default location will already be populated in the text box (for example, local_drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\ISAPI\).

  6. The Confirm Installation page appears. Click Next to continue.

  7. The Installation Complete page appears. Click Close to close the Setup Wizard.

Creating a Simple Web Part Library Project

This section explains how to create a Web Part project in Visual Studio .NET.

  1. Click Start, point to All Programs, point to Visual Studio .NET, and click Visual Studio. NET.

  2. On the File menu, point to New and click Project.

    –OR-

    Press CTRL+SHIFT+N.

    By default, the New Project dialog defaults to Visual C# and selects the Web Part Library template.

  3. Choose a location to which to save the project, type a name for the project, and click OK.

    The project has now been created with the appropriate references.

Adding a New File to a Web Part Library Project

This section shows how to add a file to the Web Part project. The template package installs the following templates:

  • Web Part (Basic)
  • Consumer Web Part (implementing Connections)
  • Provider Web Part (implementing Connections)
  • Tool Part
  • Web Part DWP
  • WP Manifest

To add a Tool Part to the project

  1. In Visual Studio .NET, on the File menu, click Add New Item.

    –OR-

    Press CTRL+SHIFT+A.

  2. Add a new Tool Part to the project.

  3. Expand the Local Project Items and click Code.

  4. Select the Tool part template.

  5. Type a name for the file and click Open

    Visual Studio adds the Tool Part to the project.

Conclusion

Web Parts for Windows SharePoint Services are ASP.NET server controls. The templates included in this package are intended for use in developing Web Parts. For more information about developing Web Parts for SharePoint Products and Technologies, see the Microsoft SharePoint Products and Technologies SDK.