Home > SharePoint Development > SharePoint Lists Web Service – making sense of the return value

SharePoint Lists Web Service – making sense of the return value

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  (http://weblogs.asp.net/paulballard/archive/2005/05/08/Using-Data-From-SharePoint-2003-Lists.aspx)

  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.

Advertisements
  1. Kevin I
    November 27, 2008 at 4:32 pm

    You can make it easier on yourself if you try out the SharePointUtility dll which comes with the SSIS adapters. The DLL is used by the adapters, and provides an easier API to interface with the lists webservice. Getting the errors out is very easy (and many are translated). Try it out!
    http://www.codeplex.com/SQLSrvIntegrationSrv

    Kevin I

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: