Retrieve Any Fields for InfoPath from Another SharePoint List


So I have used owssvr.dll before to export excel documents of lists etc on the fly but the other day when I was exploring InfoPath workarounds for SharePoint lists (related to issues with Managed Paths and a bunch of other things) I found out that there are even more functions to the wonderful URL protocol!

Let me explain.

Way back in the 2001 SharePoint days the OWSSVR.dll was extremely important to remotely invoke functions against SharePoint data. In 2003, and now 2007 it’s not as important, but still used by applications like SharePoint Designer and InfoPath.

What I am going to describe is how I used it to resolve a specific InfoPath need, but you can also use it for XML webparts, or any other systems that can interpret XML šŸ™‚

In InfoPath if you try and connect to SharePoint lists when using Managed Paths (This may be resolved in SP2) InfoPath will give you errors and all sorts of trouble. The ‘workaround’ for this is to simply reference the SharePoint lists using owssvr.dll and set it up in InfoPath as a data connection receiving XML (since that’s what the address we use will return).

The method is outlined in pretty good detail in this article: http://www.sharepoint-tips.com/2007/01/infopath-form-services-implementing.html (which is also great if you want to implement a master detail relationship *wink wink*).

We use a URL similar to the one shown below:

http://portal/_vti_bin/owssvr.dll?Cmd=Display&List=GUID&View=GUID&XMLDATA=TRUE

This is specified as the source in a new data connection which retrieves data. Complete the data connection wizard (after adding the url) and you should now have the SharePoint data available for use in the InfoPath form (this can be used in expression controls, drop downs and other fun InfoPath controls).

Some Quick Notes:

Using the above url line will cause an XML file of the list’s contents to be returned.

To retrieve the list GUID or the view GUID for use in the url command simply navigate to the list of choice, select list settings and in the top URL bar will be the List GUID (converted for web etc) and if you scroll down to where views are listed in list settings you can click on any specific view and you will get the view GUID showing in the top URL bar (again converted).

If you are having trouble transforming the values of the GUID follow these basic steps:

  1. Copy the URL into notepad.
  2. Replace all “%7B” with {
  3. Replace all “%2D” with –
  4. Replace all “%7D” with }

That should make it easy to copy and paste the GUID’s into the URL properties of the owssvr.dll address. šŸ™‚

The OWSSVR.dll can also do more than what I have described here and I highly recommend being aware of it for use in third party applications and for quick tricks: http://msdn.microsoft.com/en-us/library/ms478653.aspx

Hope this helps someone else,
Richard Harbridge

Advertisements
Explore posts in the same categories: Fix, InfoPath, Issue Resolution, Planning, SharePoint 2007

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

One Comment on “Retrieve Any Fields for InfoPath from Another SharePoint List”

  1. mohammed Says:

    Thanx so much for this

    it’ s so helpfull


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: