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定位,无语了。

  • 相关阅读:
    个人项目作业
    第一次博客作业
    我和计算机的恩怨情仇
    OO第四单元总结暨学期总结
    OO第三单元总结
    OO第二单元总结
    OO第一单元总结
    提问回顾与个人总结
    [技术博客]使用pylint实现django项目的代码风格检查
    BUAA软工-结对项目作业
  • 原文地址:https://www.cnblogs.com/lambertqin/p/1970895.html
Copyright © 2011-2022 走看看