使用 SharePoint 列表项更新列表项
我正在尝试使用列表 Web 服务中的“UpdateListItems”方法更新 SharePoint 列表项。 CAML 查询:
"<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + itemID + "</Field>" +
"<Field Name='Status'>" + itemStatus + "</Field></Method>"
itemID、itemStatus 并作为参数从 UI 传递。 这会出现以下错误
<Result ID="1,Update">
<ErrorCode>0x80070005</ErrorCode>
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x80070005)
</ErrorText>
</Result>
任何人都可以帮忙。 还有一个问题是更新方法仅基于 ID 起作用,或者是否也有可能传递 Title。
谢谢
I am trying to update SharePoint List Item using "UpdateListItems" method in Lists Web service.
CAML Query:
"<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + itemID + "</Field>" +
"<Field Name='Status'>" + itemStatus + "</Field></Method>"
itemID,itemStatus and passed from UI as parameters.
This gives following error
<Result ID="1,Update">
<ErrorCode>0x80070005</ErrorCode>
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x80070005)
</ErrorText>
</Result>
Can any one help.
One more question is the update method works only based on ID or is there any possibility of passing Title also.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您现在可能不需要,但这可能对面临同样问题的其他人有帮助。
有时,此错误的原因是 SOAP 操作中的标头。您需要设置以下内容才能进行更新:
beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
我创建了以下函数来发送 Sharepoint 列表的更新:
You might not need at this moment, however this might be helpful for someone else facing the same issue.
Sometimes the reason for this error is the headers in the SOAP action. You need to set the following in order to make updates.:
beforeSend: function(xhr) { xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
I've created the following function to send updates at Sharepoint Lists:
尝试使用以下 CAML 工具之一:
http://msdn.microsoft.com/en-us/library/ff648040.aspx
Try using one of this CAML tools:
http://msdn.microsoft.com/en-us/library/ff648040.aspx