Partager via


Web Service Guidelines

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The Windows SharePoint Services Web services provided by the Microsoft.SharePoint.SoapServer namespace include methods for accessing content on a Web site—such as for working with lists or site data—as well as methods for customizing meetings, imaging, document workspaces, or search.

SOAP interfaces used in these services provide Microsoft .NET Framework developers with object models for creating solutions that work with Windows SharePoint Services remotely from a client or custom application. The interfaces are defined through the server-side object model of the Microsoft.SharePoint assembly, and their design is optimized to reduce the number of roundtrips transacted between client computer and server.

Most Web services provide their functionality through the /_vti_bin virtual directory, which maps to the \\Program Files\Common Files\Microsoft Shared\web Server extensions\12\ISAPI physical directory in the file system. The Administration Web service uses the /_vti_adm virtual directory, which maps to \12\ADMISAPI.

Note

Windows SharePoint Services does not require the implementation of a particular version of SOAP. The SOAP response in any transaction with Windows SharePoint Services is managed by the .NET Framework.

Guidelines

You can create a project in Microsoft Visual Studio 2005, such as a Windows application or console application, that uses a Windows SharePoint Services Web service to interact with SharePoint site and list data. For introductory information about creating a project in Visual Studio that works within the context of Windows SharePoint Services, see Getting Started with Programmatically Customizing a SharePoint Web Site in Visual Studio. After you create a project, you must set a reference to the Web service you want to implement in your code, specifying the full path to the Web service in relation to the site containing the data.

To add a reference to a Windows SharePoint Services Web service in Visual Studio

  1. In Solution Explorer, right-click References, and then click Add WebReference.

  2. In the Add Web Reference dialog box, for URL, type the absolute URL for the Web service in the following format: A path that includes the Web site for which the Web service will be available.

    http://MyServer/[sites/][MySite/][MySubsite/]_vti_bin/Web_Service.asmx
    

    If you are using methods in the Administration Web service, instead specify a path that goes to the administration port and that uses _vti_adm as the virtual directory, as follows:

    http:// MyServer:Port_Number/_vti_adm/Admin.asmx
    
  3. Type a Web reference name, and then click Add Reference.

Instantiating a Service

Instantiate a Web service within code by using a constructor as follows:

Web_Reference_Name.Service_Name ServiceInstanceName = new Web_Reference _Name.Service_Name();

Web_Reference_Name represents the name used for the reference to the Web service in Visual Studio, and Service_Name represents the name of the class providing methods that can be called through the Web service.

Establishing User Credentials

To establish system credentials for the current security context in which the application is running, add the following line after the previous line, which authenticates the user running the code by passing their default credentials to the Web service from the system credential cache.

ServiceInstanceName.Credentials = System.Net.CredentialCache.DefaultCredentials
ServiceInstanceName.Credentials = System.Net.CredentialCache.DefaultCredentials;

Programming Tasks

The following programming tasks demonstrate how to use a Web service in Windows SharePoint Services:

How to: Add Users to a Group

How to: Return Lists

How to: Return List Items

How to: Update List Items

How to: Remove a Meeting from a Meeting Workspace

See Also

Concepts

Getting Started with Programmatically Customizing a SharePoint Web Site in Visual Studio