SharePoint List Data in XML (2)

A technique we used extensively in STS still applies to WSS: How to get data from your SharePoint lists in XML format. It’s actually quite simple, and you don’t need to use web services to get it.

WSS supports a number of protocols to interact with the data. SOAP and WEBDAV immediately come to mind for most of you, but you may be forgetting the elusive URL Protocol (GET). Luckily for you, it’s simple to use, and returns data in the MS-standard rowset stream format.

Follow along with these steps, and you’ll be pleased with the results, I’m certain.

Determine the GUID of a list whose data you need in XML.
Navigate to the allitems.aspx view of the list in question
Click the “Modify Settings and Columns” link on the left side
Copy the List’s GUID (including curly braces) from the address bar
Construct the URL to retrieve the list’s data in XML format (it’s case sensitive, be careful!)
The requested object is http://servername/sitename/_vti_bin/owssvr.dll
The object will expect three parameters: Cmd, List and XMLDATA (case sensitive)
Since we’re displaying items (in XML format), the value of the Cmd parameter should be Display
We want to grab the list whose GUID we determined in step one; the value of the List parameter is this GUID (including curly braces)
Of course, we want XML data to be returned; the value of the XMLDATA parameter will be TRUE
Putting this together, we get a URL that looks like this:
http://server/site/_vti_bin/owssvr.dll?Cmd=Display&List=E1D9FED5-2531-413F-8C0F-CAA5C6280E51&XMLDATA=TRUE

Sit back and marvel at how easy it is to get a rowset out of SharePoint without using the Object Model or the Web Services. You can point a Data View web part to this URL and grab data from another SharePoint site without adding the whole site to your DV catalog listing.

You may find that it doesn’t return EVERY field. That’s right: It returns fields that are defined in the default “allitems” view of that particular list. If you want more fields, you have two choices:

Modify the allitems.aspx view to show more fields (easy)
Pass an additional URL parameter, View, with the GUID value of the view whose fields you want to return (a little more involved/tedious)

Credit:  Soumya Dasari

Path: http://blogs.siliconindia.com/soumyadasari/How_to_get_data_from_your_SharePoint_lists_in_XML_format-bid-MX65g41k45644402.html

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s