A Compendium of MOSS List Access and Manipulation Techniques using Services and RPC – Part 1

I expect to be using these series of posts to compile the myriad ways you can access a list using MOSS services and RPC. Specifically, I’ll be adding posts that contain the following:

  1. Examples of using OTB services provided that allow access to lists remotely
  2. Examples of client code written in various languages (C#, Java, PHP, JQuery/AJAX)
  3. Reading and writing to lists, views, and folders via services
  4. Cross list queries and Linq to Lists

Most of this information has already been documented elsewhere and I’ll add those references as I move along. The main reason for this post is to finally save myself, and clients, a bunch of time hunting for the same information each time the topic comes up. This first post will be short and with very little code. Part 2 is when things start getting fleshed out more from the client perspective.

The Basics

The MOSS web application (portal) I created for these examples is located at the following URL (locally by me only). I tell you this for reference only. Here it is:

http://currier-win03en.dev.currier.vm

I also created a sample list on that site, called Rooms, to help illustrate a few techniques. This list will probably be used throughout the series.

image            

At this point lets begin looking at lists with some “must have” utilities that will make your life easier. Here are a couple I recommend.

SharePoint Utilities for Developers (SPUD) – http://spud.codeplex.com/

Here is a screen shot of this utility looking at the Rooms list above

image

Note the right window. This contains a bunch of information you will need later to help build list queries and generally debug your coding efforts. Of course, you will need the proper authorization to gain access to whatever list you plan on using.

List queries depend on a special XML syntax called a CAML query. The above utility will display a lists equivalent CAML query, or a query for one of its views, as shown in the next image.

image  

Creating a CAML query can be a bit difficult so a great tool that will help in this regard is U2U CAML Query Builder  found here http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=28

A few other tools may be helpful as well

SharePoint Tool Basket – http://sptoolbasket.codeplex.com/

Stramit SharePoint 2007 Caml Viewer – http://www.codeplex.com/SPCamlViewer

If you want to build a CAML query using .NET objects this one is interesting, CAML.NET – http://www.codeplex.com/camldotnet

Finding web services on your farm

Once you have a handle on CAML queries you need some way to pass them back to MOSS lists. Many options exist and within each option are often several methods to do the same thing. Understand that services provided by MOSS are mapped to ALL sites within the farm.

The syntax for locating SOAP services is: http://{server}/{site}/_vti_bin/{service name}.asmx . So using the Lists.asmx service from my MOSS portal I can use the following URL

http://currier-win03en.dev.currier.vm/_vti_bin/Lists.asmx

But I could also find the same services at

http://currier-win03en.dev.currier.vm/Site1/_vti_bin/Lists.asmx

All services are mapped to the same virtual directory. I won’t list all the services as yet but clicking on the service end-point page will look something like the next image. 

image

You can also find the WSDL for any service using the URL as follows, where ?WSDL is appended to the end of the URL 

http://currier-win03en.dev.currier.vm/Site1/_vti_bin/Lists.asmx?WSDL

The above URL returns a screen that appears as shown here

image 

Front Page – Remote Procedure Call

Another “type” of web service (not SOAP AMSX) also lives within MOSS. These web services are tied to a special URL protocol and called Front Page – Remote Procedure Call. If I had to guess I would say this method of making service calls will be deprecated over the long term. However, it currently is an option to access, post, and otherwise manipulate list data. You use this style of service via an assembly as shown here.

http://WebApp/%5Bsite%5D/_vti_bin/owssvr.dll?Cmd={command}&List={ListGuid}&Query={query}

An example of how this can be used with the the Rooms list noted above is as follows. First, lets find out the list GUID of the rooms list. One way to do that is to go into the list settings. You will see the Guid as part of the URL – in my case the guid is d8d532f6-e87e-4fb3-b3e1-92dbec0ea893

A reference to the Front Page RPC commands can be found here – http://msdn.microsoft.com/en-us/library/ms478653.aspx

Here is an examples using my Rooms list

 http://currier-win03en.dev.currier.vm/_vti_bin/owssvr.dll?Cmd=Display&List={d8d532f6-e87e-4fb3-b3e1-92dbec0ea893}&Query=*&XMLDATA=TRUE

The actual returned page looks as follows

image

 

Ok, this concludes the basics. Try out the utilities and samples above on your own list. In part 2, I’ll describe ways to call these services and filter returned XML.

No worries, The next post will be code heavy using C# to start.

Advertisements

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