Installing CMIS4sharePoint

Before starting see the Download page to get "CMIS4SharePoint" and the "ConsoleClientCMIS".

Host a WCF service on SharePoint

To get the power of WCF, which is not included by default in SharePoint we have to realize the support in a personalized way.
the steps are described on the Sahil Malik’s blog

We will try in what follows to take these steps while adding to those specific to IIS 7.0 and Windows Server 2008

Step1:Create a WCF directory under SharePoint
Step2:Creating a WCF library
Step3:Create the .svc file
Step4:Write "WCF Virtual Path Provider"
Step5:Custom URLs for REST Services
Step6:Put the CMIS4SharePoint.dll file in the GAC
Step7:Put CMIS4SharePoint.svc and web.config file under the WCF directory in SharePoint (see step 1)
Step8:Execute the console command c:\>iireset

Example of consuming CMIS services

Once CMIS4SharePoint properly installed (Test the operation with a web browser), we will now illustrate the use of CMIS, with a client that will list the name and URL of all document libraries available on the SharePoint site.
To start we'll create in a client computer (other than the SharePoint server) a new Console project in Visual Studio 2008 called "ClientTestCMIS.
Once the project created, right click on the project in Solution Explorer and select "Add Service Reference".

addService.png

In the dialog box that opened, enter the address of your service, press "GO" and then select the named service, as illustrated in this screenshot:

addService2.png

Rename the namespace of the service and validate.
Now Visual Studio generated proxy that includes all services. Now we just have to implement our program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClientTestCMIS.CMISReference;

namespace ClientTestCMIS
{
    class Program
    {
        static void Main(string[] args)
        {
            //create a proxy to consume the services
            RepositoryServiceClient repositoryClient = new RepositoryServiceClient();
            
            //Open the connection
            repositoryClient.Open();
            
            //Sending the request to get all
            cmisRepositoryEntryType[] repositories = repositoryClient.GetRepositories();

            //Close the connection
            repositoryClient.Close();
            

            //Display result
            foreach (cmisRepositoryEntryType item in repositories)
            {
                
                Console.WriteLine("Name={0}\nURL={1}\n", item.repositoryName, item.repositoryURI);
                
            }
        }
    }
}

Note the addition of the using ClientTestCMIS.CMISRefrence; it's in order to facilitate the use of intellisense.

And the result:

resultClient.png

We were able to list all document library of SharePoint without using the SharePoint’s Web-services.

> Remarque:
> if you fail to run, and you receive an exception on the "endpoints". * Check the App.config file * of your client.
> and Check the "address" attribute of the "endpoint" node.
> In our case we used the IP address because our SharePoint server is not part of the domaine.

configClient.png

Last edited Dec 4, 2009 at 8:52 AM by achaabouni, version 4

Comments

No comments yet.