401 Unauthorized Error When Accessing SharePoint Document Folder

Our Sharepoint/D365 Sales integration worked great, until one day it didn’t.

When trying to access a document folder, and also when trying to run the “Enable Server-Based SharePoint integration wizard, “we got the following error: “The remote server returned a 401 unauthorized error.”

401 error

This was odd, because Sharepoint had previously been configured successfully, and the user had been able to store documents under the entity for many months prior. The solution turned out to be entering the user’s email address on the System User form.

By default, the SharePoint Email Address field is not exposed on the System User main form. You will have to customize the form to expose the field, and then you can populate it.

Once you have customized the form, go to Settings -> Security -> Users. Open the user record, and enter the email address with which the user is logging into Dynamics 365 in the SharePoint Email Address field . Usually, but not always, this is the same address as in the Primary Email field. Save the user record.

Then test access to the Documents folder again. The change should take effect immediately, and you will be back in business.