左右间

行走在左右之间

博客园 首页 新随笔 联系 订阅 管理

使用SharePoint就像小时候玩藏宝游戏,不停的去找,总能找到新东西。

以前使用CAML很多次,虽然知道他很强大,但只是局限于查询。今天读了一篇文章,才知道他还可以用来批量更新。不多说,直接上XML sample.

<?xml version="1.0" encoding="UTF-8"?>
  <ows:Batch OnError="Return">
 <Method ID="{0}">
 <SetList>{1}</SetList>
 <SetVar Name="Cmd">Save</SetVar>
 <SetVar Name="ID">{2}</SetVar>
 <SetVar Name="urn:schemas-microsoft-com:office:office#Processed">{3}</SetVar>
 <SetVar Name="urn:schemas-microsoft-com:office:office#Processed_Date">{4}</SetVar>
        </Method>
  </ows:Batch>

据SDK记载,Batch标签有如下描述。
<Batch
  OnError = "Return" | "Continue"
  ListVersion = ""
  Version = ""
  ViewName = "">
  <Method>
  ...
  </Method>
  ...
</Batch>

Return :在第一次出错后不再执行后续的Methiod.
Continue :在出错后继续执行后续的Methiod.
ListVersion :List的版本号。(可选)
Version :SharePoint的版本号。(可选)

在sample中,{1}为List ID.{2}为Item ID.{3}和{4}为要更新的属性值。其中属性的名称为<schema>#<internal_field_name>.
比如,你的List名字为Processed,那么,这里的名称为urn:schemas-microsoft-com:office:office + # + Processed。

 

<Method ID="Text"  Cmd = "Text">
</Method>

Cmd

Delete — Delete the specified item.

New — Create the specified item.

Update — Modify the specified item.

 

参考文章:http://msdn.microsoft.com/en-us/library/cc404818.aspx

posted on 2008-07-30 11:12  左右间  阅读(1953)  评论(0编辑  收藏  举报