zoukankan      html  css  js  c++  java
  • 使用Web Service重命名一个文件夹

    官方文档已经有详细的说明了,就是有一个问题要注意:

    <Batch OnError="Continue" PreCalc="TRUE" ListVersion="0" ViewName="{EF2F5A21-0FD0-4654-84ED-112B4F5A48F8}">
       <Method ID="1" Cmd="Update">
          <Field Name="ID">3</Field>
          <Field Name="owshiddenversion">1</Field>
          <Field Name="FileRef">
             http://Server/[sites/][Site/]Shared 
             Documents/Folder</Field>
          <Field Name="FSObjType">1</Field>
          <Field Name="BaseName">Name</Field>
       </Method>
    </Batch>
    这里FileRef指的是文件夹修改之前的一个路径,而不是之后的。
    例如,你需要把Test文件夹改名为Test(Updated), 正确的CAML是:
    <Batch OnError="Continue" PreCalc="TRUE" ListVersion="0" ViewName="{EF2F5A21-0FD0-4654-84ED-112B4F5A48F8}">
       <Method ID="1" Cmd="Update">
          <Field Name="ID">3</Field>
          <Field Name="owshiddenversion">1</Field>
          <Field Name="FileRef">
             http://Server/[sites/][Site/]Shared 
             Documents/Test</Field>
          <Field Name="FSObjType">1</Field>
          <Field Name="BaseName">Test(Updated)</Field>
       </Method>
    </Batch>

    否则你会得到这样一个不知所云的错误

    <UpdateListItemsResult><Results><Result ID="1,Update"><ErrorCode>0x81020016</ErrorCode><ErrorText>Item does not exist

    The page you selected contains an item that does not exist.  It may have been deleted by another user.</ErrorText>

    SharePoint居然不仅仅用ID定位,无语了。

  • 相关阅读:
    老王python博客
    python中文分词
    python 字典(dict)get方法应用
    python yield和generators(生成器)
    python ASCII返回对应的值(chr)
    python 字符串特点
    python 包的定义,结构,导入过程
    fabric的安装和配置
    python 正则表达式re findall
    python unittest单元测试方法和用例
  • 原文地址:https://www.cnblogs.com/lambertqin/p/1970895.html
Copyright © 2011-2022 走看看