Click here to Skip to main content
Licence CPOL
First Posted 25 Aug 2008
Views 18,902
Bookmarked 22 times

How to use sharepoint webservices in web application

By | 25 Aug 2008 | Article
How to use sharepoint webservices in web application
 
Part of The SQL Zone sponsored by
See Also

Introduction

How to use the sharepoint web services in the web application.This process is very easy to use just add web reference to the webservice and start using.

1-Add the webservices reference to your project

Here are list of sahrepoint webservices i have used

1-DWS-Create delete folder

2-Lists-Display List of document and folder

3-Copy-to copy the document from one folder to other on the sharepoint

 1-How to create a folder from the web application onto the sharepoint.I have use the SharePoint webservice called DWS
var dwsService = new Dws();

dwsService.Credentials = new NetworkCredential("Tanveer", "Test", "MyDomain");

dwsService.Url = SharePointWebServiceLocation + "dws.asmx";

dwsService.CreateFolder(FolderLocation.Replace(" ", "%20") + "/" + NewFolderName.Replace(" ", "%20"));

 2-How to  Delete Folder?.
var dwsService = new Dws();

dwsService.Credentials = new NetworkCredential("Tanveer", "Test", "MyDomain");

dwsService.Url = SharePointWebServiceLocation + "dws.asmx";

dwsService.DeleteFolder(FolderLocation.Replace(" ", "%20"));

 3-How to delete a document-List webservice is used for this

var listService = new Lists();

listService.Credentials = new NetworkCredential("Tanveer", "Test", "MyDomain");

listService.Url = SharePointWebServiceLocation + "lists.asmx";

string strBatch = "<Method ID='1' Cmd='Delete'>" +

"<Field Name='ID'>1</Field>" +

"<Field Name='FileRef'>" + Filepath + "</Field></Method>";

var xmlDoc = new XmlDocument();

XmlElement elBatch = xmlDoc.CreateElement("Batch");

elBatch.SetAttribute("OnError", "Continue");

elBatch.SetAttribute("PreCalc", "TRUE");

elBatch.SetAttribute("RootFolder", FileParentPath);

elBatch.InnerXml = strBatch;

XmlNode ndReturn = listService.UpdateListItems(NodeName, elBatch);
3: To copy user can use the copy web services 
4: To move a document , make a copy of the document and then use the list 
UpdateListItem method to delete the old document

Points of Interest

C#, Sahrepoint ,Asp.net

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

T.Ashraf

Technical Lead
TANVTECH
United States United States

Member

More than 10 years of experience in design, architecture and development of various commercial objects oriented application using C# 3.5, ASP.net, relational database like SQL 2008, Oracle, MySQL and SharePoint. Experienced in client-server application development, data security management system, e- commerce, automation processes, claim payment systems, file system and tracking systems, also has very good exposure to the entire software development life cycle.
Tanvtech.com
http://tanvtech.com/Articles/MyFirstSSRSReport.aspx
http://tanvtech.com/Articles/MyFirstSSRSSubReport.aspx
http://tanvtech.com/Articles/MyFirstWcfArticle.aspx
http://tanvtech.com/Articles/MyFirstWcfClientArticle.aspx

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionSecure - packet sniffer PinmemberMember 82158320:47 3 Feb '12  
QuestionUse Flex or Flash to read/write to SharePoint PinmemberAlex Dove9:07 12 Nov '09  
AnswerRe: Use Flex or Flash to read/write to SharePoint PinmemberT.Ashraf17:20 13 Nov '09  
Questionwhere to add this code? PinmemberMember 14432782:43 9 Sep '08  
AnswerRe: where to add this code? PinmemberT.Ashraf8:42 15 Sep '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 25 Aug 2008
Article Copyright 2008 by T.Ashraf
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid