Coldfusion 9 Sharepoint Integration - ListCollection

ColdFusion 9 saw the release of quite a bit of new functionality none so little blogged about as the new cfsharepoint tag. Not all surprising really since in order to use the cfsharepoint tag you need to have a Microsoft Sharepoint server at your disposal. Another reason it's probably not so often blogged about is that Sharepoint integration is going to be typically going on behind the scenes, integration projects with corporate Intranets and perhaps not really all that interesting for the masses.

Never the less I have decided to start a small series of blog posts on some of the different things you can do with the cfsharepoint tag. I will only be concentrating on document lists as that is where, in my opinion, most of the integration is going to be centered around.

Authenticating

An important point to remember is that the cfsharepoint tag supports basic authentication only. This means no https and no NTLM.

You must send the login credentials with each and every request. You can either use the tag attributes: username,password,and domain, or create a structure with the keys username,password,and domain and pass it in the login attribute.

The domain is the url (without http) to the home location in Sharepoint including server name (ip) and port (if you installed sharepoint on a non standard port).

List Collections

The list collection is a method exposed by the lists webservice, you can view all the available methods of the lists webservice by visiting http://sharepoinserver/home/_vti_bin/Lists.asmx adding ?WSDL to the end will give you the full WSDL of the lists webservice. Note that the cfsharepoint tag only supports a limited subset of the available methods.

If you are a masochist you can use cfinvoke to invoke the webservice methods not supported by the cfsharepoint tag.

To get the a list collection run the following code against your sharepoint server substituting the username, domain and password for your environment.


<cfsharepoint action="getlistcollection"
            username="#username#"
            domain="sharepointserver/home/"
            password="#password#"
            name="listCollection"/>

A structure containing two keys will be returned, resultflag and lists. The resultflag should return SUCCESS if everything went well. The lists key contains an array of all the available lists. Since we are only interested in document lists we will need to filter out all the non-document related lists. Document lists have a ServerTemplate id of 101. Unfortunately we can't send a CAML query with the getlistcollection method in order to reduce the returned list with only the list types we are interested in.

The list collection contains a heck of a lot of information about the available lists, but other than the ServerTemplate and the ID or Name we don't really need much more information.

The ID or Name attribute of a Sharepoint List is a UUID for example:{A3EA94F4-9F1B-43A0-B197-085BA1E258C9} this is what we will use to get additional information about a list we are interested in.

Whats Next

Now that we have our list collection we can start working towards retrieving information about a particular list such as what meta-data a user wishes to see for the desired list via Views (ViewCollection) and how to retrieve specific information based on a view using QueryOptions and ViewFields. And finally we will get the list items using the getListItems action.

Happy Coding...

8 Comments to "Coldfusion 9 Sharepoint Integration - ListCollection"- Add Yours
Brian FitzGerald's Gravatar Hi Gary, this series is of direct interest to me, as I will be doing some cfml/sharepoint integration in the near future. Is there also a Sharepoint http/xml API? If there is, it seems not to be very well documented. When Googling, I have come across quite a few mentions of it, but no official documentation site.

Either way, thanks for sharing your experiences with the cfsharepoint tag.

Brian
# Posted By Brian FitzGerald | 2/3/10 2:46 PM
Gary Gilbert's Gravatar The Documentation is pretty sparse I will admit. I've used a Sharepoint book as well as some examples of sharepoint wsdl's and CAML to get anything useful out.

It may take a week or so but at the end of the series you should at least be able to provide a user an interactive means to import or retrieve files (and metadata) from sharepoint
# Posted By Gary Gilbert | 2/3/10 2:58 PM
Dawn Sekel's Gravatar Are you using Sharepoint 2010 yet? Do you know if CFSharepoint will work wtih 2010?
# Posted By Dawn Sekel | 5/26/10 8:50 PM
Gary Gilbert's Gravatar Our test server is 2009 at the moment, we haven't yet upgraded it to 2010, but unless they have changed the webservices or api it "should" still work since cfSharepoint is "simply" a wrapper for webservice calls.
# Posted By Gary Gilbert | 5/27/10 9:29 AM
Steve's Gravatar I can do most of the usergroup.wsdl services but when I try using the lists webservice using CFSHAREPOINT i keep getting a

AxisFault
faultCode: {http://www.w3.org/2003/05/soap-envelope}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
   {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.


Any clue was to what is happening here. SP is on a VMWARE instance.
# Posted By Steve | 2/14/11 11:25 PM
E.Shaffer's Gravatar Has ANYONE figured out how to make CF9 calls to Sharepoint with NTLM (Basic Authentication "NOT" turned on)???
The only thing I've heard of someone doing was to code a DOT Net web service to connect to Sharepoint via NTLM,
but I can't find any particulars about it. If someone has figured out a way to do this, they aren't talking about it.

I'm getting rather desperate for a solution! Thanks in advance!
# Posted By E.Shaffer | 2/14/12 1:52 AM
Gary's Gravatar Sorry E.Shaffer, can't be done. The sharepoint tag does not support NTLM. The only way that you can connect to sharepoint with coldfusion over NTLM is to write your own components that connect directly to the exposed sharepoint web services.
# Posted By Gary | 2/15/12 10:21 AM
Sean Openshaw's Gravatar Great articles, Gary! What is know about integrating with an ADFS configuration. I'm trying to pull calendar events using CAML query via SP web services.
# Posted By Sean Openshaw | 2/15/12 8:44 PM

Powered By Railo

Subscribe

Subscribe via RSS
Follow garyrgilbert on Twitter Follow me on Twitter
Or, Receive daily updates via email.

Tags

adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui

Recent Entries

No recent entries.

Blogroll

An Architect's View
CFSilence
Rey Bango
TalkingTree

Wish List

My Amazon.com Wish List