SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint

<reposted from May 18, 2004> 

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.

Rather than go into a bunch of detail, let's put ourselves to work, shall we? Follow along with these steps, and you'll be pleased with the results, I'm certain. Smile

  1. 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
  2. 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
  3. 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:

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

Did you like this tip? Comment!


Posted 06-22-2007 8:44 AM by Dustin Miller

Comments

Cassie wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 06-22-2007 9:27 AM

One thing to note is that when you retrieve the guid from the browser it already has the curly braces and hyphens in html friendly form. You can take the string and put it directly in the List url parameter.  List=%7BED640BE4%2D7D8C%2D4F8D%2D882A%2D230EE7D334C5%7D

Dave Christianson wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 06-22-2007 3:54 PM

Hey, here's hoping someone is reading this.  This is exactly what I need, however, I want to access the list of document libraries on my site.  I don't see anywhere to do that in SP designer.  Would also be nice to be able to add columns to the document library list, but I suppose that's asking too much.

Thanks for any help.

Links (6/24/2007) « Steve’s SharePoint Stuff wrote Links (6/24/2007) &laquo; Steve&#8217;s SharePoint Stuff
on 06-24-2007 7:52 PM

Pingback from  Links (6/24/2007) &laquo; Steve&#8217;s SharePoint Stuff

Sharepoint link love 6-25-2007 at Virtual Generations wrote Sharepoint link love 6-25-2007 at Virtual Generations
on 06-25-2007 2:05 AM

Pingback from  Sharepoint link love 6-25-2007 at  Virtual Generations

Breton Slivka wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 07-02-2007 12:47 AM

If you are using a dataview webpart and want the document libraries list, you can use this datasource string:

<DataSources><asp:SiteMapDataSource SiteMapProvider="SPNavigationProvider" ShowStartingNode="False" id="QuickLaunchSiteMap1" StartingNodeUrl="sid:1025" runat="server">

</asp:SiteMapDataSource></DataSources>

The xml format is not the rowset format, so watchout- This returns the whole sitemap. You can take your document library list from a branch on this xml.

Breton Slivka wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 07-02-2007 12:47 AM

If you are using a dataview webpart and want the document libraries list, you can use this datasource string:

<DataSources><asp:SiteMapDataSource SiteMapProvider="SPNavigationProvider" ShowStartingNode="False" id="QuickLaunchSiteMap1" StartingNodeUrl="sid:1025" runat="server">

</asp:SiteMapDataSource></DataSources>

The xml format is not the rowset format, so watchout- This returns the whole sitemap. You can take your document library list from a branch on this xml.

bathroom vanities wrote bathroom vanities
on 07-31-2007 9:54 AM
bathroom vanities wrote bathroom vanities
on 07-31-2007 9:54 AM
bathroom faucets wrote bathroom faucets
on 08-02-2007 2:21 PM
bathroom sinks wrote bathroom sinks
on 08-03-2007 5:37 PM
bathroom vanity cabinet wrote bathroom vanity cabinet
on 08-04-2007 11:54 AM
bathroom vanity wrote bathroom vanity
on 08-04-2007 7:10 PM
bazztrap wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 08-15-2007 1:31 PM

Does not do it for moss

Manish MISTRY wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 11-20-2007 7:23 PM

Excellent Tip! Probably this is what I wasted my whole yesterday looking for!

Thanks a lot!

Alberto wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 06-25-2008 9:46 AM

It should be the best way to access WSS data, shall we call it REST mode ?

On many lists in my WSS3 site I have no response from owssvr.dll . In WSS log I find (example):  unexpected C++ exception: [INDEXERR] Illegal Index (4294967295) for collection with 9 elements .

Continuity wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 09-03-2008 11:51 PM

This has saved my life... Is it possible to use a similar url call to retrieve a single item from the list as xml?

Using the RPC method via the URL Protocol « Path to SharePoint wrote Using the RPC method via the URL Protocol &laquo; Path to SharePoint
on 09-23-2008 9:45 PM

Pingback from  Using the RPC method via the URL Protocol &laquo; Path to SharePoint

Mark S B wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 10-03-2008 4:03 AM

Do you need any special rights on the server for this to work?

I get an error saying cannot complete this action.

any ideas?

SPTim wrote re: Don't forget: Web Services/SOAP isn't the only path to XML from SharePoint
on 10-22-2008 8:53 AM

Alberto, regarding the error unexpected C++ exception: [INDEXERR] Illegal Index (4294967295) for collection with 9 elements .  I've found that it can happen if you have a column with multiple values.  It seems to choke both when it's people or groups with multiples or lookup with multiples.  Hope this helps!

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.