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. 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.UpdateLis开发者_开发技巧tItems and filter then update but I haven't been able to find the syntax for it.
In pseudo: Update the [Name] to "NewName" of all items in [ListA] where [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".
I cannot reference the Microsoft.SharePoint assemblies so ideally this is in one service call.
You will have to make 2 calls, one to retrieve the matching items and one to do the update(s).
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/
精彩评论