Retrieve Absolute and Site Collection URL Request in Dynamics CRM

By | October 12, 2016

In Microsoft Dynamics CRM, many emails and notes along with attachment gets created on daily basis, which results into increase in the CRM database storage which is expensive.

So usually, people go with the integration of Dynamics CRM with SharePoint which reduces the CRM database storage.

We receive many such requests where client wants to move the files from emails or notes attachments to SharePoint.

So while integrating i.e. moving file from CRM to SharePoint, we require SharePoint URL.

For getting the SharePoint URL, we generally retrieve the default site and using this default site we need to generate the absolute URL.

Instead of doing this i.e. retrieving default site, CRM has a request “RetrieveAbsoluteAndSiteCollectionUrlRequest” using which we can get the absolute URL.

This request requires the document location id of a specific entity record. So before executing this request, we need to retrieve the Document Location record which is then passed to “RetrieveAbsoluteAndSiteCollectionUrlRequest” request to get the absolute URL.

As you know, Document location only stores the relative URL. See below screenshot.Retrieve absolute

Here we take an example of account entity.

Below is the code to retrieve the Document location record against the account.

The above function will return the document location collection and this collection can be passed to request to get the absolute URL.

In above code, we have passed the retrieved SharePoint document location record id which will return us the Absolute URL and site collection URL.

Conclusion:

The request “RetrieveAbsoluteAndSiteCollectionUrlRequest” was introduced in 2013 and it can be used to get SharePoint absolute URL.

Now do Accounting without leaving your Dynamics CRM – Try InoLink ( Integrating QuickBooks with Dynamics CRM)!

Leave a Reply