Here is a game to play with fellow SharePoint addicts (don’t try it with your family…): list all the options you are aware of to retrieve the content of a SharePoint list. This could actually be an interesting way to kick off a SharePoint workshop with advanced users.
For me, the URL protocol of the RPC method is one of the most intriguing. In this post we are going to experiment with it. Then in my next post I’ll put it to work, to display random pictures on a SharePoint page.
The URL protocol
The URL protocol provides direct access to a specific content of your site (library or list). To me, it looks very similar to the REST methods proposed by other applications.
Let’s run a few experiments to better visualize the concept. For this you’ll need a SharePoint site with a couple libraries and lists. For example I’ll have the “Shared documents” library and a tasks list:
In the address box of your browser, replace the library URL with this:
The browser will display the list of documents in your “Shared documents” library. You won’t be able to do much with this, but this is an easy way to show owssvr.dll at work.
– select a list on your site, for example the tasks list
– display the Web page source (from your browser: view | source)
– search for “o:WebQuerySourceHref”
– copy the URL next to it and paste it in your browser address box
And your browser should display an XML formatted view of your list (not user-friendly, but you should be able to recognize the content of your list).
The above example shows that lists and views in SharePoint are identified by unique numbers (GUID). You’ll need these numbers every time you want to use the URL protocol.
There is more to it than these basic examples. The URL protocol is very handy to get access to your content in a snap.
However, don’t see the URL protocol as a universal answer. There are several constraints that restrict its use. Here is a (certainly incomplete) list:
– Currently, the URL protocol doesn’t work with anonymous access. It seems to be a bug, according to this post:
– You cannot use it in conjunction with the XML Web Part (this is also an authentication issue):
– I was not able to make it work with some lookup fields
– You cannot apply customizations like grouping
– A warning about some parameters being case sensitive:
A couple years ago, it is thanks to blogs that I discovered the URL protocol. Here is an early reference from May 2004 (by Dustin Miller) that still applies:
Never too late to say thank you 🙂
A more recent post that includes interesting comments about the Query, FilterFieldn and FilterValuen parameters:
And for a more complete reference, see the Microsoft WSS SDK: