Windows Forms and Sharepoint Webservices

No.of Views1051
Bookmarked0 times
Downloads 
Votes0
By  André Lage   On  03 Jul 2010 07:07:11
Tag : SharePoint , Development and Programming
One of the difficulties when we develop applications in support of SharePoint is to realize the necessity of a server where SharePoint is installed, now imagine you can develop support tools and access to data in SharePoint without developing or using the Server's DLL's in Sharepoint as "Microsoft.SharePoint.dll, "the answer is simple, using Web Services.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

One of the difficulties when we develop applications in support of SharePoint is to realize the necessity of a server where SharePoint is installed, now imagine you can develop support tools and access to data in SharePointwithout developing or using the Server's DLL's in Sharepoint as "Microsoft.SharePoint.dll, "the answer is simple, using Web Services.

Scenario:

Often there is a need for applications in customer support or Listing Data in SharePoint to other databases for integratingtion made to measure.

Great, how's Web Services for SharePoint canm help?

Overview

Microsoft SharePoint provides a set of Web Services that support the external application.Web Services are methods for listing and support to the method using SOAP and XML, used properly is a very important tool in your development.
Web Services are on the server where SharePoint is installed:
 

% CommonProgramFiles% \ Microsoft Shared \ web server extensions \ 12 \ ISAPI


Link to List of Web Services that SharePoint provides http://msdn.microsoft.com/pt-br/library/bb862916.aspx.

In this example I will make an application in Windows Forms to List all users of a SharePoint site.To call the web services will use the method "UserGroup " I will use to listthe users Site st.

Example

http:// [url] / _vti_bin / UserGroup.asmx? WSDL

 

Image Loading

One of the features. Net is the ability to convert our Web Services Classes. .Net,even though it read.Microsoft SharePoint for each area Web Services with many methods that will serve to support our development.

Conversion WebService for Class. CS

PATH C: \ Program Files \ Microsoft Visual Studio 8 \ SDK \ v2.0 \ Bin "

wsdl.exe / l: CS / n: Company /October: C: \ListaSharepoint\UserGroup.cs http:// [url] / _vti_bin / UserGroup.asmx? WSDL

Commands:

  • / L: Language that will be converted "VB" or "CS"
  • / N: namespace of the class constructed
  • / October: file converted from WebService 
Image Loading

After using the command line to convert the Web Service in class, we can add our solution in Windows Forms and use their methods to developments.

Windows Forms Listing users

After adding the new class can start using our methods to list the users to use content from our Web Services will need to use classes to return XML users. 

Image Loading Image Loading

Example for Listing visitors

UserGroup user = new UserGroup();         
            / / Sharepoint Site to search users
            utilizadores.Url = String. Concat (TxtUrl.Text,"/ _vti_bin / usergroup.asmx");   

            / / User Credentials
            utilizadores.Credentials = CredentialCache. DefaultCredentials
            XmlNode userNodes utilizadores.GetAllUserCollectionFromWeb = ();
            DataSet dsXML = new DataSet();using (XmlNodeReader reader = new XmlNodeReader(userNodes))
            (
                dsXML.ReadXml (reader);
            )
            String[] username = new String[dsXML.Tables ["User"]. Rows.Count];         

            / / List of usersfor (int i = 0; i <dsXML.Tables ["User"]. Rows.Count; i + +)
            (
                LstUtilizadores.Items.Add (dsXML.Tables ["User"]. Rows [i] ["loginname"]. ToString ());
            ) 
          )

 Attach web service in client.

Image Loading

Done, we list all users of the site using the SharePoint Web Services for SharePoint, can begin to make application in Windows Formswithout using the DLL "Microsoft.SharePoint.dll.

Sample Project Source

Download source files -131 kb

 
Sign Up to vote for this article
 
About Author
 
André Lage
Occupation-Not Provided
Company-Not Provided
Member Type-Senior
Location-Portugal
Joined date-09 Jun 2010
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top