Wednesday, April 6, 2016

Tip of the Day!!

You can retrieve the full SharePoint SiteCollection URL & Absolute URL for any CRM record  via the CRM SDK using RetrieveAbsoluteAndSiteCollectionUrlRequest class.

SiteCollection URL : URL of the SharePoint site associated with CRM

Absolute URL : The location URL of the actual folder in SharePoint where documents would be stored (for a particular CRM record)

Sample Code:

RetrieveAbsoluteAndSiteCollectionUrlRequest retrieveRequest = new RetrieveAbsoluteAndSiteCollectionUrlRequest{
      Target = new EntityReference("sharepointdocumentlocation", [SharepointDocumentLocationId])
            RetrieveAbsoluteAndSiteCollectionUrlResponse retriveResponse = (RetrieveAbsoluteAndSiteCollectionUrlResponse)organizationProxy.Execute(retrieveRequest);

string siteCollectionUrl = retriveResponse.SiteCollectionUrl;

string absoluteUrl = retriveResponse.AbsoluteUrl;