A better SharePoint Connector – part 3

It has been a bit quiet around the development of a better CRM / SharePoint Connector. Today I had the opportunity to write some testing code. The hard part in the development is the REST connectivity. In my article “Integrating CRM Online and SharePoint Online: I need a hammer!” I posted some helper classes that facilitated the SharePoint REST connectivity and authentication. The authentication was written for SharePoint OnLine.

Today I made some modifications to the  SPOAuthUtility and the HTTPHelper to make the authentication to work as well with the on-premise version of SharePoint 2013. Furthermore I made a start with the SharePointConnector class.

The API is going to be straight forward:

Classes

The methods in black are already implemented, the methods in grey are under construction. With a couple of lines of code a file can be retrieved from SharePoint.

// set the file Url (full url)
string fileUrl = "http://dev-bvdsande:8080/shared documents/Test document on SharePoint.docx";

// set the site Url
string siteUrl = "http://dev-bvdsande:8080";

// Connect to the local environment (somple constructor)
SharePointConnector cls = new SharePointConnector(siteUrl);

// get the file bytes from SharePoint
byte[] result = cls.GetFile(fileUrl);

In the next days, I’ll be working on “add” and “delete” functionality.

So stay tuned!

Leave a Reply

Your email address will not be published. Required fields are marked *