At times, you might encounter an issue with documents linking from Dynamics CRM to SharePoint. After a document migration from the source systems, the count of folders created and documents linked may all look well. All documents are present at the SharePoint location, but upon accessing the documents from a CRM record, you get an “Unexpected Error” message as below:

dynamics-crm-unexpected-error

Solution

To resolve this issue, go to Settings > Document Management > SharePoint Document locations.

troubleshoot dynamics crm sharepoint documents 2

Here are the steps to follow:

  1. Look for the record that is regarding the record in issue.
  2. Open the record.
  3. Note the folder name (1)this is to take the documents backup and delete/ rename in SharePoint.
  4. Deactivate the record.
  5. Open the CRM entity record in issue > Documents. The “Unexpected Error” would not be there any more. Depending on your settings, you would either get a prompt to confirm document location, or you would see the option to “Add Location” as below.

document-associated-grid

  1. Click Add Location. Update details if required. Note the folder Name (2).
  2. Click Save.

add-location

  1. Go to the SharePoint site (https://<company>.sharepoint.com/sites/<organization>).
  2. Click on “Site Contents” and go to folder (1).
  3. Download the documents, then rename this record.
  4. Now go to folder (2). Drag drop all downloaded documents from previous step here. Give it a few seconds. Refresh Dynamics CRM and check for the documents in CRM

Few reasons for this issue could be having special characters in the folder location names/very long folder names.

Note: You need “System Administrator” role both in Dynamics CRM and SharePoint to perform all the steps above.