博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Sharepoint CAML 增删改查 List
阅读量:4677 次
发布时间:2019-06-09

本文共 7771 字,大约阅读时间需要 25 分钟。

 

Lists.UpdateListItems 方法 (websvcLists)

Windows SharePoint Services 3
 
Adds, deletes, or updates the specified items in a list on the current site.

 

命名空间: websvcLists
程序集: STSSOAP (在 stssoap.dll 中)

C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/UpdateListItems", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] public XmlNode UpdateListItems (	string listName,	XmlNode updates)

 

参数

listName

A string that contains the name of the list. It is recommended that you use the list GUID surrounded by curly braces (i.e., "{

GUID}"), but you can also use the list display name.

updates

A element that contains one or more methods for adding, modifying, or deleting items and that can be assigned to a System.Xml.XmlNode object.

The following example shows how to modify column values for two specified items.

XML
4
Value
6
Value

An empty ViewName attribute in the element causes the default view to be used. The ID attribute in each element uniquely identifies the specific update so that errors and return values can be properly identified. Each method that is posted contains elements that specify the ID of the item and the new field value for the item. The field ID does not correspond to the index of the item in the collection of items for the list.

The following example shows the format for adding a new item that contains both a Date value and a DateTime value.

XML
New
Value
2007-3-25
2006-1-11T09:15:30Z

The following example shows how to delete two items.

XML
2
8
注释注意:

IDs for deleted items are maintained after delete operations. Consequently, the example deletes the second and eighth items in the list, but 2 and 8 are not reassigned as the IDs of other items.

For descriptions of the various formats used for field types that can be passed in this parameter see .

The following examples show the methods that can be posted for operations related to document libraries:

  • Create a folder

    XML
    New
    1
    Name
  • Update a folder

    XML
    3
    1
    http://Server/[sites/][Site/]Shared Documents/Folder
    1
    Name
  • Delete a folder

    XML
    4
    http://Server/[sites/][Site/]Shared Documents/Folder
  • Update documents

    XML
    2
    1
    http://Server/[sites/][Site/]Shared Documents/File
    Name
  • Delete documents

    XML
    3
    http://Server/[sites/][Site/]Shared Documents/File

 

 

返回值

An XMLDATA fragment in the following form that shows the status of each method block posted through the
updates parameter and that can be assigned to a
System.Xml.XmlNode object. For items successfully updated, a row fragment is returned with the updated row values.
XML
0x00000000
0x00000000
...
In this example, the
ows_Author and
ows_Editor attributes pertain to lookup fields to another list in the database, representing the integer IDs of items in the UserInfo table and the actual values contained by these items within the table.

The following code example modifies the values of two different field values within two items in a list on the current site. The example uses an XmlDocument object to create XmlNode objects for parameters.

This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

C#
Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();listService.Credentials= System.Net.CredentialCache.DefaultCredentials;string strBatch = "
" + "
4
" + "
999
" + "
6
" + "
2003-11-11T09:15:30Z
"; XmlDocument xmlDoc = new System.Xml.XmlDocument();System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");elBatch.SetAttribute("OnError","Continue");elBatch.SetAttribute("ListVersion","1");elBatch.SetAttribute("ViewName", "0d7fcacd-1d7c-45bc-bcfc-6d7f7d2eeb40");elBatch.InnerXml = strBatch;XmlNode ndReturn = listService.UpdateListItems("List_Name", elBatch);MessageBox.Show(ndReturn.OuterXml);

 
<div><img alt="DCSIMG" id="Img1" width="1" height="1" src="http://m.webtrends.com/dcsmgru7m99k7mqmgrhudo0k8_8c6m/njs.gif?dcsuri=/nojavascript&WT.js=No" /></div><a href="http://www.omniture.com" title="Web Analytics"> <img src="//msstonojsmsdn.112.2o7.net/b/ss/msstonojsmsdn/1/H.20.2--NS/0" height="1" width="1" border="0" alt="" /> </a>

转载于:https://www.cnblogs.com/nanfei/p/4039621.html

你可能感兴趣的文章
【校招面试 之 C/C++】第33题 C++ 11新特性(四)之STL容器
查看>>
Java替代C语言的可能性
查看>>
android ListView中CheckBox错位的解决
查看>>
linux下的mongodb数据库原生操作
查看>>
BNUOJ 1268 PIGS
查看>>
菜鸟的MySQL学习笔记(三)
查看>>
商业选址5A法则
查看>>
POJ 1191 棋盘分割(区间DP)题解
查看>>
文件同步服务器,iis 集群 ,代码同步(一)
查看>>
JS之模板技术(aui / artTemplate)
查看>>
【Tomcat】Tomcat Connector的三种运行模式【bio、nio、apr】
查看>>
Mysql-2-数据库基础
查看>>
python把源代码打包成.exe文件
查看>>
PhotoshopCS5中将单位修改成百分比
查看>>
赵雅智:js知识点汇总
查看>>
cocos2d-x 3.0rc1 编译cpp-testsproject
查看>>
《Java虚拟机原理图解》1.3、class文件里的訪问标志、类索引、父类索引、接口索引集合...
查看>>
三种常见的图像处理双三次插值算法
查看>>
开玩笑html5(五岁以下儿童)---绕地球月球,地球绕太阳运动(canvas实现,同样可以移动哦)...
查看>>
安卓启动相关以及架构设计相关
查看>>