我一直在尝试为MOSS站点创建一个批量更新程序,基于这里的MSDN示例:http://msdn.microsoft.com/en-us/library/cc404818.aspx。不幸的是,虽然更新查询没有发生错误,但列表中的数据没有变化。CAML更新正在运行,但没有更改数据(Sharepoint 2007)
这里是批处理命令我使用:
<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是添加到此列表的默认内容类型的新字段。它是一个DateTime字段。它取代原来的Date_x0020_of_x0020_Birth字段(现在的显示名称为“出生日期(文本)”),这是一个文本字段,它包含01/01/1900之前的值。批处理更新是在可能的情况下将日期从文本字段复制到新的日期时间字段。
我能想到的唯一的事情是,我使用的是:
<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>
谢谢,我会尝试瓮前缀,我没有想到这一点。我尝试过其他领域,他们也不会更新。我实际上在周末使用Web服务重新编写了这个代码(因为我的智慧已经结束并且需要让它工作),并且它与UpdateListItems服务一起工作良好,但是我仍然想要深入到底部它。 – Iain 2011-01-23 22:29:55