Can I update a sharepoint list item using list webservice updatelistitem method's field title instead of field Id. for eg: msdn sample uses Field Name ID batchElement.InnerXml = "" + "6" + "Modified sixth item" + "7" + "Modified seventh item" + "5" + "" + "Added item"
Since I am pulling the information from sql db to update the list and I 开发者_如何学Pythondont know the item id, can i use title as condition to update the other item fields?
- Gane
Are you querying gthe sharepoint database when you say " I am pulling the information from sql db"? If so don't. If not and you are using an external db in which you store an item's title, you probably need to do a call to the same service's GetListItems method, using a query the returns items based on the Title field. The query would be something like so:
<Query>
<Where>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Title of item</Value>
</Eq>
</Where>
</Query>
or, if you need more, nest the Eq elements in OR's like so
<Query>
<Where>
<Or>
<Or>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Title of item</Value>
</Eq>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Other Title of item</Value>
</Eq>
</Or>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>Yet another Title of item</Value>
</Eq>
</Or>
</Where>
</Query>
Then use the ID's in the result of this call to build your batch xml.
精彩评论