Talk to sharepoint through its web services

Solo disponible en BuenasTareas
  • Páginas : 14 (3444 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de febrero de 2011
Leer documento completo
Vista previa del texto
Talk to SharePoint Through its Web Services [Archive]
01. Jan, 2007 0 Comments by admin
Introduction
Microsoft Office is very tightly integrated with SharePoint by utilizing its web services. Windows SharePoint Services comes with sixteen different web services. SharePoint Portal Server supports an additional five web services. The web services provided by SharePoint do provide a vastarray of features. But not all SharePoint features are accessible through them. If required you can build your own web service on top of SharePoint leveraging the managed SharePoint server API itself. The web service interfaces make it very easy to integrate SharePoint capabilities right into your application.
This article is not a detailed documentation of every web method and web service providedby SharePoint. It is rather an introduction to its capabilities and how to use them. You can download the Windows SharePoint Services SKD or the SharePoint Portal Server SKD for a complete reference of all web services and also of the server API itself. Please refer to this article for a guide how to install and administrate SharePoint or this article for a guide how to use and customizeSharePoint portals.
How to add a Windows SharePoint web service reference
You can add a web reference to each SharePoint web service through your Visual Studio .NET IDE. In your Solution Explorer right click on your project and select “Add Web Reference” from your popup menu. The table below shows the URLs to use for each web service provided by WSS. Enter the URL to the web service and click the Gobutton. This will show you in the dialog box a summary of all available web methods. Next enter the name of the web reference and then click Add Reference.
WSS Web Services Web Reference
Administration Service http:///_vti_adm/admin.asmx
Alerts Service http:///_vti_bin/alerts.asmx
Document Workspace Service http:///_vti_bin/dws.asmx
Forms Service http:///_vti_bin/forms.asmx
Imaging Servicehttp:///_vti_bin/imaging.asmx
List Data Retrieval Service http:///_vti_bin/dspsts.asmx
Lists Service http:///_vti_bin/lists.asmx
Meetings Service http:///_vti_bin/meetings.asmx
Permissions Service http:///_vti_bin/permissions.asmx
Site Data Service http:///_vti_bin/sitedata.asmx
Site Service http:///_vti_bin/sites.asmx
Users and Groups Service http:///_vti_bin/usergroup.asmx
Versions Servicehttp:///_vti_bin/versions.asmx
Views Service http:///_vti_bin/views.asmx
Web Part Pages Service http:///_vti_bin/webpartpages.asmx
Webs Service http:///_vti_bin/webs.asmx
Setting the web service user credentials
The SharePoint web services only accept calls from existing SharePoint users and do also enforce access security. Import the System.Net namespace into your project and then use theNetworkCredential class to set the user credential to use for the web service call. Here is a code snippet:
public static XmlNode VersionsGetVersions(string SharePointHost, string
UserName,
string Password, string Domain, string FileName)
{
// proxy object to call the Versions web service
Versions.Versions VersionsService = new Versions.Versions();
// the user credentials to useVersionsService.Credentials = new NetworkCredential(UserName, Password,
Domain);
VersionsService.Url = SharePointHost + “_vti_bin/Versions.asmx”;
// gets the file versions
XmlNode Result = VersionsService.GetVersions(FileName);
// dispose the web service object
VersionsService.Dispose();
return Result;
}
For example, first you create an instance of the Versions web service. Then you assign a newinstance of the NetworkCredential class to the Credentials property on the created web service object. We pass along the user name, password and the user’s domain name to the NetworkCredential object. Next you set the web service URL, which might very well be different from the one used when you created the web reference. Finally you invoke the desired web method, in the code snippet above the...
tracking img