HOW TO: Retrieve and Display CMIS data in SharePoint using REST Atom Service

Posted by kmcfadden

In a previous blog I discussed “how to” enable the Content Management Interoperability Service (CMIS) in SharePoint 2010. In that blog I also reviewed the SharePoint built in Web Part for getting data from a CMIS enabled site using WSDL.

In this blog I will show how you can access CMIS data in SharePoint using the REST Atom Service. I borrowed primarily from Jaspers’ Weblog for how to do this and from the msdn guidance for implementing CMIS. I ran into one problem along the way which I will discuss at the end.

The first step in getting data from a REST Atom Service is to create a data provider control in SharePoint.

Creating a REST Atom Service data provider control in SharePoint 2010

 

1) Open SharePoint Designer and open the site you wish to display the remote data
2) Select “Data Sources” from the list of Site Objects in the navigation panel on the left part of the screen.
3) Click the “REST Service Connection” button from the “Data Sources” ribbon.

A dialog box for entering Data Source Properties will open. Enter the properties as follows.

General Tab
Enter any name, description, and keywords that you wish

Source Tab
• Choose a HTTP method and data command.
• Enter connection URL.

MSDN URL Format
http://Site URL/_vti_bin/cmis/rest/[Library or List GUID]?command
Example
http://armws2008sp-01:2397/_vti_bin/cmis/rest/EF9A4CB3-BEF0-44B3-975A-611601D47425?getRepositoryInformation

Jasper’s Weblog URL Format:

http://web.site.com/sub/site/_vti_bin/ListData.svc/ListName
Example
http://armws2008sp-01:2397/_vti_bin/ListData.svc/SharedDocuments

Login Tab
• Select “Save this username and password in the connection”
• Enter the username and password.

4) Click “OK” to save.

All examples in step 3 work fine in the Firefox REST client extension. You would act on data in lists and libraries following the syntax from the MSDN example. In this case you have to have the GUID of the list or library. You get a list of lists and libraries, list items, and documents and their GUIDs following the example in Jasper’s web log.

Displaying REST provider data in a DataView

The following provides instructions for implementing a SharePoint DataView using a REST provider. This information comes primarily from Jaspers’ Web log.

1) Open the SharePoint site where REST/CMIS data is to be displayed in SharePoint Designer
2) Open the page where you wish to insert the DataView
3) Select the “Insert” ribbon.
4) Select the “Data View” button from the ribbon and select the REST data source.

You can modify the presentation of the data view and which fields are shown while looking at the web part’s properties while still in SharePoint Designer.

REST Data Issue

I ran into a problem trying to get the CMIS data to display in the DataView control. I used the REST client extension in Firefox to investigate the problem. The response I would get started with

Status Code: 405 Method Not Allowed

For reasons I don’t recall – possibly inspecting events in the windows event viewer of the server I was targeting in my URL – my next step was to test the ListData.svc, which you can do by opening a browser to the ListData.svc URL:

http://Web site or Localhost/_vti_bin/listdata.svc/
http://armws2008sp-01:2397/_vti_bin/ListData.svc/, for example

The error I got back was

“Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from assembly ‘System.Data.Services, Version=3.5.0.0…’”

A google search brought me to “Michael’s coding thoughts” blog. His similar issue was solved by installing an update to ADO.NET Data Services, which has in it the REST services.

In retrospect I should have checked if I had the updated dll version before running the update installation. Looking at the GAC it appeared to be version 3.5.0 which didn’t change after running the update. I finally realized I had to select the file and view its properties to verify the actual version In any event, that did not make the problem go away for me.

Further searching led me to the” XML Journal” blog which identified the absence of ADO.NET Data Services 1.5 CTP2 as the cause of this issue. I installed this software, though for me, as for the author, it did not appear to fix the problem. Following his example I rebooted the server and the problem went away – just as it did for the blog author.

With any luck this information will help you if you are trying to implement CMIS in SharePoint 2010!