Upload Document to Sharepoint Online Workflow Dynamics 365
In information migration from the legacy system to Dynamics 365, one of the mutual requirements that I have seen is the migration of the documents. Previously, we either have to develop our own .Cyberspace panel awarding or use 3rd party tools. But now, nosotros tin can leverage the Microsoft Power Platform to build the aforementioned mechanism using Power Automate instant menstruum.
In this blog post, you will learn how to accomplish the following using the menstruum from Ability Automate.
- create SharePoint Document Locations creation in Dynamics 365 or Common Data Service
- migrate documents to SharePoint folder of D365/CDS record
- use SharePoint connector actions such as Listing folder, Create new binder, Copy file
The Use Instance: The requirements for each document migration volition be unlike just in this web log mail, I will demonstrate the solution based on the post-obit requirements.
The files from the legacy system are placed into a shared network folder in which at that place are multiple subfolders
Each subfolder contains the files for each Account tape and the binder name is the exact match of Account Number
The Account records are already in that location in the Dynamics 365 system and the SharePoint document location for the records may or may not be existing
Offset of all, the files are in the local network binder and at present on the Microsoft cloud. Technically, we tin can use the File System connector and install On-premises Gateway to retrieve the files only let'due south simply upload the files to SharePoint commencement for the sake of simplicity in this data migration. (if the requirement is for on-going document integration, File System connector and On-premises Gateway would require if the files are not on the cloud)
Y'all can use this solution and tweak a little bit to trigger the automated catamenia when a file is placed into the shared network folder or uploaded into a staging SharePoint library.
Depending on the size/number of files, there are a couple of approaches to upload those local files to the SharePoint binder. For a few hundred to a couple of thousand of files, you may just open up up the staging SharePoint folder and select all the files to drag & drop upload from the browser. But if there are a lot of records, you may sync the staging SharePoint folder with the OneDrive for Business sync client and move the local files into the synced OneDrive folder.
Once the files are in that location in the staging SharePoint binder, we can just create a flow for the document migration. This is the summary of the solution and the detailed caption of the catamenia steps can be found below.
- Manually trigger a period
- Initialize Source Site Address variable
- Initialize Source Folder variable
- Initialize Destination Site Address variable
- Initialize Destination Binder variable
- List Account parent Document Location
- List staging Certificate folder
- List Account records with Account Number
- List existing Certificate Location of Account
- Prepare Destination Folder variable with existing Document Location
- Set Destination Folder variable with new SharePoint binder
- Create new SharePoint folder for Account
- Create Document Location for new SharePoint folder
- List files from staging document folder
- Copy file into Account Document folder
This footstep is self-explanatory. Since nosotros are going to practice ane-fourth dimension data migration, the flow volition be manually triggered.
The source SharePoint site address is stored in the variable to permit referencing in various places of the flow.
The source SharePoint staging folder where the original documents are uploaded is stored in the variable to allow referencing in various places of the flow. As the initial testing to load only a few Account records, a new binder can exist created to copy a few documents folders for the testing purpose.
The destination SharePoint site address is stored in the variable to allow referencing in various places of the flow. east.g. If we desire to exam the migration, nosotros can point it to the SharePoint site integrated with the UAT surroundings.
The destination folder variable is initialised to become the SharePoint binder of the record either from the Document Location record (for records with existing SharePoint folder) or from the binder creation step later on in the flow.
This step retrieves parent Document Location record for Account. It is required for "14. Create Document Location for new SharePoint binder" to set the parent document location for new Certificate Location record.
After initialising all necessary variables and retrieving required information, the first step is to retrieve all items (subfolders) in the staging SharePoint binder using Source Site Address and Source Folder variables.
For each document subfolder in the staging SharePoint folder, recollect the Name and GUID of Account record where the Account Number = subfolder proper noun. Supposition: The Account Number is unique for all Account records in the organization and the Account record will be referenced as first(outputs('List_Account_records_with_Account_Number')?['torso/value']) in the expressions from next footstep onwards.
Side by side step is to retrieve Document Location records with the AccountID and check if the accountidrecord has an existing Document Location record created.
If at that place is an existing Certificate Location, prepare the Destination Folder variable with the relativeurl value from the existing Document Location tape.
If in that location is no existing Document Location folder for the Account tape, set the Destination Folder variable in a format that SharePoint integration creates a binder. <<Account Proper noun>>_<<Account GUID without '-'>> (e.grand. "Contoso Corporation_89CF8AE3F4A3453BAC5CCB05A76BFA40")
Use the value from the Destination Folder variable and Destination Site variable to create a new SharePoint folder under Business relationship Library. The library proper noun is hardcoded to Business relationship but depending on the brandish proper noun of the entity, it may change to Organisation or any value that may take been prepare.
Then, create the Document Location tape to map the newly created SharePoint folder with the Business relationship record. The value from step 6. List Account parent Document Location will exist used in Parent Site field, accountid in Regarding field and Destination Binder variable in Relative URL field.
At present, nosotros are sure that in that location is a SharePoint binder for the Account tape. It is time to call back all the files from the subfolder from the staging SharePoint folder using Source Site Address variable, Source Binder variable and the subfolder name.
The last step is to re-create each and every file from the staging subfolder into the Destination Site Address , account Library, Destination Folder .
Summary
By using the SharePoint connector and Mutual Data Service (electric current environment) connector, we can build a flow which uploads files into the SharePoint folder related to the Dynamics 365/CDS record.
You tin can download the in a higher place sample catamenia from my GitHub repository via this link.
Source: https://linnzawwin.blogspot.com/2020/04/upload-sharepoint-documents-for.html
Post a Comment for "Upload Document to Sharepoint Online Workflow Dynamics 365"