zoukankan      html  css  js  c++  java
  • 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
    
    
    http://www.codeproject.com/Articles/28822/How-to-use-sharepoint-webservices-in-web-applicati
  • 相关阅读:
    Go安装
    Redis 安装与使用
    scala总结
    C++学习笔记4
    LeetCode 22.将数组分成和相等的三个部分
    LeetCode 21.二叉树的直径 DFS深度遍历
    LeetCode 20.买卖股票的最佳时机 暴力破解法与动态规划
    LeetCode 19.凑零钱问题 动态规划
    LeetCode 18.队列的最大值
    Java SSM Spring MVC 三层架构和MVC+SpringMVC的入门案例+请求参数的绑定+常用的注解
  • 原文地址:https://www.cnblogs.com/Areas/p/2418291.html
Copyright © 2011-2022 走看看