Posts Tagged ‘Web Services’

SharePoint Lists Web Service – making sense of the return value

November 13, 2008 1 comment

The return values from the SharePoint Lists web service tend to be fairly unintelligible, even for something as straightforward as GetListItems.

The best tip I’ve come across for extracting data from the Lists web service return value is to be found on Paul Ballard’s blog  (

  XmlNode returnValue = listsService.GetListItems(listName, null, query, viewFields, null, queryOptions, null);
  String xPathQuery = "//*[local-name() = 'data' and namespace-uri() = 'urn:schemas-microsoft-com:rowset']/*[local-name() = 'row' and namespace-uri() = '#RowsetSchema']";
  XmlNodeList listItems = returnValue.SelectNodes(xPathQuery);

Using the XPath query defined above makes life so much easier – trust me.  And don’t be put off by the title of Paul’s article, this works equally well for Office SharePoint Server 2007 and WSS 3.0.