CAML 更新正在运行,但未更改数据 (Sharepoint 2007)

发布于 2024-10-13 08:12:45 字数 1865 浏览 4 评论 0原文

我一直在尝试根据此处的 MSDN 示例为 MOSS 站点创建批量更新程序: http://msdn.microsoft.com/en-us/library/cc404818.aspx。不幸的是,尽管更新查询运行没有错误,但列表中的数据没有改变。

这是我使用的批处理命令:

<Method ID="3767">
  <SetList>8468cf0a-7e10-439c-a9b4-4197543e7b38</SetList>
  <SetVar Name="Cmd">Save</SetVar>
  <SetVar Name="ID">3767</SetVar>
  <SetVar Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</SetVar>
</Method>

运行批处理更新命令后:

string batchReturn = web.ProcessBatchData(batch);
returns:
<Results>
  <Result ID="3767" Code="0"></Result>
</Results>

列表项上的主版本号增加,但字段中的数据没有更改: Date_x0020_of_x0020_Birth1

我被难住了。

更多背景信息:Date_x0020_of_x0020_Birth1 是添加到此列表的默认内容类型的新字段。它是一个日期时间字段。它取代了原始的 Date_x0020_of_x0020_Birth 字段(现在显示名称为“出生日期(文本)”),该字段是一个文本字段,因为它包含 1900 年 1 月 1 日之前的值。批量更新是在可能的情况下将文本字段中的日期复制到新的日期时间字段。

我唯一能想到的是我正在使用:

<SetVar Name="Cmd">Save</SetVar>

也许我需要“更新”或“保存”命令,所以我尝试了这个:

<Method ID="1" Cmd="Update">
  <Field Name='ID'>3767</Field>
  <Field Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</Field>
</Method>

但是返回:

<Results>37671971-12-18T00:00:00Z<Result ID="1" Code="-2130575350">
  <ErrorText>Invalid URL Parameter

  The URL provided contains an invalid Command or Value. Please check the URL again.    
  </ErrorText>
</Result>
3767Date_x0020_of_x0020_Birth1
<Result ID="1" Code="-2147023673">
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x800704c7)</ErrorText>
</Result>
</Results>

I've been trying to create a batch update program for a MOSS site, based on the MSDN example here: http://msdn.microsoft.com/en-us/library/cc404818.aspx. Unfortunately, although the update query is running through with no errors, the data in the list is not changing.

Here is the batch command I use:

<Method ID="3767">
  <SetList>8468cf0a-7e10-439c-a9b4-4197543e7b38</SetList>
  <SetVar Name="Cmd">Save</SetVar>
  <SetVar Name="ID">3767</SetVar>
  <SetVar Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</SetVar>
</Method>

Upon running the batch update command:

string batchReturn = web.ProcessBatchData(batch);
returns:
<Results>
  <Result ID="3767" Code="0"></Result>
</Results>

The major version number on the list item is incremented, but no changes are made to the data in field: Date_x0020_of_x0020_Birth1

I'm stumped.

More background: Date_x0020_of_x0020_Birth1 is a new field added to the default content type fo this list. It is a DateTime field. It supercedes the original Date_x0020_of_x0020_Birth field (now has a display name of "Date of Birth(Text)") which was a text field, dues o it containing values prior to 01/01/1900. The batch update is to copy dates from the text field to the new DateTime field where possible.

The only thing I can think off is that I'm using:

<SetVar Name="Cmd">Save</SetVar>

Perhaps I need the "Update" or "Save" command, so I tried this:

<Method ID="1" Cmd="Update">
  <Field Name='ID'>3767</Field>
  <Field Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</Field>
</Method>

But that returns:

<Results>37671971-12-18T00:00:00Z<Result ID="1" Code="-2130575350">
  <ErrorText>Invalid URL Parameter

  The URL provided contains an invalid Command or Value. Please check the URL again.    
  </ErrorText>
</Result>
3767Date_x0020_of_x0020_Birth1
<Result ID="1" Code="-2147023673">
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x800704c7)</ErrorText>
</Result>
</Results>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鲜肉鲜肉永远不皱 2024-10-20 08:12:45

“更新”是正确的 CMD,听起来更新进展顺利(更新版本号)。

这只是离开了该字段,它可能是您正在使用的“名称”。

您是否尝试使用 urn 前缀 (urn:schemas-microsoft-com:office:office#Date_x0020_of_x0020_Birth1)

您可以尝试更新不同的字段,例如标题。 (urn:schemas-microsoft-com:office:office#Title)

如果这一切都失败,您可以尝试使用lists.asmx上的UpdateListItems

"Update" is the right CMD, and it sounds like the update is occuring fine (updating the version number).

That just leaves the field, and it is probably the "Name" you are using.

Did you try using the urn prefix (urn:schemas-microsoft-com:office:office#Date_x0020_of_x0020_Birth1)

Can you try updating a different field, like the title. (urn:schemas-microsoft-com:office:office#Title)

If that all fails you could try using the UpdateListItems on the lists.asmx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文