web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Retrieve the SharePoint Document location URL using CRM SDK

Denny Profile Picture Denny

The ‘SharePoint Document Location’ entity record in CRM is the link between the CRM record and the actual document uploaded within SharePoint.
For every document uploaded in SharePoint (from within CRM) there could be 1 or multiple ‘Document Location’ records created in CRM, depending on the SharePoint folder structure configured within ‘Document Management’ Settings.

The actual SharePoint location URL is not available in any of the ‘Document Location’ records, instead CRM automatically generates the URL based on these records.

Fortunately, CRM does provide an easy way to access the URL via SDK.
The sample code below retrieves the full URL for any SharePoint document

RetrieveAbsoluteAndSiteCollectionUrlRequest retrieveRequest = new RetrieveAbsoluteAndSiteCollectionUrlRequest{
Target = new EntityReference(“sharepointdocumentlocation”, [SharepointDocumentLocationId])    };
RetrieveAbsoluteAndSiteCollectionUrlResponse retriveResponse = (RetrieveAbsoluteAndSiteCollectionUrlResponse)organizationProxy.Execute(retrieveRequest);
string siteCollectionUrl = retriveResponse.SiteCollectionUrl;
string absoluteUrl = retriveResponse.AbsoluteUrl;

Site Collection URL: URL of the SharePoint site associated with CRM
Absolute URL: The full URL path of the folder/document within SharePoint


This was originally posted here.

Comments

*This post is locked for comments