In my article (http://dotnetstep.blogspot.com/2009/01/update-datetime-column-using-webservice.html) i used SharePoint List Service to update SharePoint ListItems. In that article i manually set batchElement.InnerXml property with Xml.
When there is to many row and you want to generate it automatically then you can use XLinq.
In following example first select all items from orders List then use item id and update each item orderdate and orderdatetime column with current date and current datetime respectively.
Lists lst = new Lists(); |
// Use XElement To Generate Batch Element Automatically
XElement orders = XElement.Parse(resultNode.OuterXml); |
Now Convert XElement to XmlNode as UpdateListItems only accept XmlNode as parameter.
XmlDocument doc= new XmlDocument(); doc.LoadXml(updatexml.ToString()); lst.UpdateListItems("Orders",doc.FirstChild); |
No comments:
Post a Comment