Click here to Skip to main content
15,892,643 members
Articles / Web Development / ASP.NET
Article

How to use sharepoint webservices in web application

Rate me:
Please Sign up or sign in to vote.
2.54/5 (5 votes)
25 Aug 2008CPOL 38.6K   23   5
How to use sharepoint webservices in web application

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)


Written By
Chief Technology Officer Compuacademy.net
United States United States
More than 15 years of experience in design, architecture and development of various commercial objects oriented application.Other Specialties

Data Migration:
• MS Access database to SQL 2005/2008
• MS Access database to Oracle
• MS Access database to My SQL
• FoxPro to SQL

Application Migration:
• Converted MS Access application to .net web application (Asp.net)
• Excel Application to .net 3.5 web application
• FoxPro application to .net 3.5
Reporting development and support
• MS access reports
• Crystal reports
• SQL Reports(SSRS)
• DevExpress reports
• Cognos reports
Application development and support
• .net Application web /Win forms
• SharePoint
• MS Access
• Website
• Ecommerce
• WCF
• Web Services
3rd Party Control Support
• DevExpress
• .netForum
• Telerik
Version controls Support
• Team Foundation Server
• Source Safe
• CVS
• SVN

Comments and Discussions

 
QuestionSecure - packet sniffer Pin
Member 82158323-Feb-12 0:47
Member 82158323-Feb-12 0:47 
QuestionUse Flex or Flash to read/write to SharePoint Pin
Alex Dove12-Nov-09 9:07
professionalAlex Dove12-Nov-09 9:07 
How can I use this web service to be able to both read information into a Flex/Flash application but to also write data to SharePoint from a Flex/Flash app. The Flex/Flash application would be sitting inside a SharePoint Content Editor Web Part accessing informaiton within the same domain on an intranet.

Please help!!!!
Thanks
Alex Dove

Alex Dove
Pivotal Solution, Inc.
www.pivotalsolution.com
847-561-9441

AnswerRe: Use Flex or Flash to read/write to SharePoint Pin
T.Ashraf13-Nov-09 17:20
T.Ashraf13-Nov-09 17:20 
Questionwhere to add this code? Pin
Member 14432789-Sep-08 2:43
Member 14432789-Sep-08 2:43 
AnswerRe: where to add this code? Pin
T.Ashraf15-Sep-08 8:42
T.Ashraf15-Sep-08 8:42 

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

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