Default User for SharePoint Document Management

 

 SharePoint Document Management 



Problem statement

In this article, we will cover implementing default users to upload the document on the SharePoint repository.

In the OOTB Dynamics 365 Finance & Operations, You need to provide the uploading rights to every user over the SharePoint folder, so he/she can upload the documents to the SharePoint.

What if your documents are secure and you want to hide one user's documents from another one?

You can implement the XDS security on the D365FO end, but what about SharePoint? if the user can directly log in to SharePoint then he/she can see the document of all other users.

Solution

In D365FO, I introduce the feature to set the default user to upload the document to the SharePoint repository on the behalf of all D365FO Users.

At the end of the article, you will find the github link to download the project.

Reference Screenshot


Before jumping directly to the solution, first, we need to understand, how the application is making the proxy connection?


D365FO makes the proxy connection using your external identity, and external identity is populated to the record only when the user login on the D365FO at least once.

What are the classes and forms D365FO is using in uploading the documents to SharePoint?

Following is the form and the classes that are in use of Dynamics 365 Finance & Operations to upload the documents at SharePoint

Form
  • DocuParameters
Classes
  • DocGlobalHelper
  • ExportToExcelStorageHelper
  • OfficeSharePointFolderSelection
  • Docu
  • CollabsitesharepointonlineProxy
  • CollabsiteSPonlineTemplateManager
  • DocDocuActionFileWithMetadata
  • DocSharePointHelper
  • DocSharePointHelperV2

What are the Implementation steps?

First, download the solution from this Download link.
Import the project into your solution.
The solution contains the following elements.
Form
  • Extension of DocuParameters
  • Extension of DocuView
Table
  • Extension of DocuParameter(Table)
Classes
  • Extension of xUserInfo 
  • Extension of DocGlobalHelper
  • Extension of DocuValue
  • New File - DownlaodSharePointFile
Menu Item
  • Download SharePoint
Now perform Build and Sync.
Now create a separate user for document management ex. D365SharePointDoc@Yourdomain.com
Create the SharePoint folder hierarchy for document management.
Grant the permission and rights to the newly created user over SharePoint and target folder.
Revoke the rights of other users from the SharePoint document folder.
Set the user as default to the document management parameter form, reference image available on Top.
Check the SharePoint connection.

When the user will upload the document at SharePoint, you will see the name of your default user name.

Reference screenshot




But on the database level, you will see the name of the user who uploaded the document.

Reference screenshot





Important 
If you are using any custom solution for attachment and uploading the document, then perform the proper testing at your end.

I have developed and tested the solution on 10.0.24.

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...