简体   繁体   English

SharePoint Lists.asmx UpdateListItems SET Field1 = NewValue WHERE Field1 = OldValue(按更新字段过滤)

[英]SharePoint Lists.asmx UpdateListItems SET Field1=NewValue WHERE Field1=OldValue (filter by to be updated field)

What I would like to do seems simple, I have an application that interacts with some SharePoint (MOSS 2007) lists via SharePoint Services. 我想做的事情似乎很简单,我有一个应用程序通过SharePoint Services与一些SharePoint(MOSS 2007)列表交互。 In one service call I'd like to update one or more list items. 在一个服务电话中,我想更新一个或多个列表项。 The problem is I want to only update those items where the field to be updated equals and old value. 问题是我只想更新要更新的字段等于旧值的项目。 My thought was to use the Lists.UpdateListItems and filter then update but I haven't been able to find the syntax for it. 我的想法是使用Lists.UpdateListItems并过滤然后更新,但我无法找到它的语法。

In pseudo: Update the [Name] to "NewName" of all items in [ListA] where [Name] = "OldName" 在伪:将[名称]更新为[ListA]中所有项目的“NewName”,其中[Name] =“OldName”

One solution I would like to avoid: Get ID of all ListItems where Name="OldName" and iterate through them making a separate service call for each one to update Name="NewName". 我想避免的一个解决方案:获取Name =“OldName”的所有ListItem的ID,并迭代它们为每个更新Name =“NewName”进行单独的服务调用。

I cannot reference the Microsoft.SharePoint assemblies so ideally this is in one service call. 我无法引用Microsoft.SharePoint程序集,因此理想情况下这是在一个服务调用中。

You will have to make 2 calls , one to retrieve the matching items and one to do the update(s). 您将需要进行2次调用 ,一次用于检索匹配项,另一次用于执行更新。

This can be fairly involved so I have written a blog post (including the necessary code) about it here: http://www.wirebear.com/blog/2011/02/11/batch-updates-with-sharepoint-2007-services/ 这可能是相当复杂的,所以我在这里写了一篇关于它的博客文章(包括必要的代码): http//www.wirebear.com/blog/2011/02/11/batch-updates-with-sharepoint-2007-服务/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM