Tuesday, January 15, 2013

Sharepoint 2013 w/ Apache Chemistry CMIS

Sharing my experience in trying to use the CMIS library to work with Sharepoint 2013.  As a prefix, I have existing code integrated into a CEVA (content-enabled vertical application, that seems to be the buzzword) using Alfresco 4.2 CE as a backend, and evaluating compatibility of the system with a Sharepoint 2013 backend (I'm not swapping to sharepoint, just cross-checking).

I use 'sp2013' for the server name, replace as appropriate.

  1. Work with CMIS-Workbench as your go-to tool for confirmation before working with your code.  This is like your SoapUI when working with Webservices, or your Database Editor tool when trying to write queries for your application.  Work through everything you want to do with CMIS Workbench *first* before you write code.
  2.  Sharepoint 2013 setup notes:
    1. Sharepoint Central Admin (http://sp2013:90/): 
      1. Security, under 'General Security' section, 'Specify Authentication Providers'. 
      2. Pick the default zone, or if you know Sharepoint the appropriate zone. 
      3. Under Windows Auth, I had to enable 'basic auth'...I also disabled integrated as my intent was to use Sharepoint soley as a repository, so no need to get the system confused between integrated or basic auth (obviously, if using this route in production, need to setup SSL).
    2. Site Settings (http://sp2013): 
      1. Pick the site you want to access through CMIS (for example, 'Documents').
      2. In the upper right, beside the login name, is a 'gear' icon for settings - click that, go to 'Site Settings'.
      3. Under 'Site Action' header is a 'Manage Site Features' link, click that.
      4. Activate 'Content Management Interoperability Services (CMIS) Producer'
      5. Repeat for each site you want to access. Each site will appear as a unique Repository from the CMIS point of view.
  3. Again, use CMIS Workbench for all your confirmation/testing.  Add some files/folders to the above Site(s)/Repo(s) you shared for CMIS.
    1. Connect to the URL http://sp2013/cmis/rest/?getRepositories through CMIS Workbench. You will likely use this one for your apache chemistry code as well.
    2. For Apache Chemistry, Lesson learned --
      1. DO NOT try to create a session by re-using your Map param and add in the repo ID...instead, get the Repository object directly, and use the Repository.createSession().
      2. For example of best-approach/usage of the Apache Chemistry CMIS library, look at the CMIS Workbench source code (that is how I learned the above error/correction).
  4. There are some CMIS functions that DO NOT work with Sharepoint 2013.  I ran into only one and have not done a thorough review, but this already delayed me significantly:
    1. SCORE() does not work in Sharepoint 2013
A HUGE kudos goes to  http://gauravmahajan.net/2013/01/06/sharepoint-2013-rtm-on-win-server-2012-virtual-machine-download/, I already spent enough time just dealing with Sharepoint and CMIS, much less getting all the infrastructure up and running - big thank you!