Skip to main content

Notifications

Announcements

No record found.

Power Automate – Migrate Data & Attachments from SharePoint to Dataverse

Ever wondered about the different ways of moving data from SharePoint to Dataverse?

There are many ways via – SSIS, Azure Data Factory, Dataflow, Scribe, and other migration tools. Let us add Power Automate to the list as well.

In today’s blog, I am sharing how to move data & its attachments using Power Automate flow. This example of flow works for multiple attachments as well.

First things first –

  1. Always add comments to your Power Automate flow. It helps you & your team to understand what this step is doing.
  2. Avoid customizing the step name. It will be overwhelming for people who do not understand Power automate triggers & actions.

Let us take a high-level view of what we want to do.

For demo purposes, the trigger used is a manual one. It may change depending upon your scenario.

Let us get our data from SharePoint list items using the action Get Items under SharePoint connector and provide the path of the Site address and the SharePoint list that we want to access.

We need to bring the attachments separately and for that use the action – Get attachments under SharePoint connector.

So far, we have the SharePoint list data and its attachments. There are following two ways –

  1. Create a new record in Dataverse
  2. Or Map SharePoint data to an existing record in Dataverse
  3. The common step – Attach the attachments (one or multiple) from SharePoint List to the same record in Dataverse.

In this blog, we will use the first way of creating a new record in Dataverse. Let’s use the action Add a new row under the Dataverse connector. I am moving data to the contacts table in this blog.

Map all the columns that you want to move. I have mapped the Title column of SharePoint to the Last Name column of the Contacts table (a bad example).

Now, since we have the main data record created in Dataverse. Let us work on the attachment migration.

Use the Get attachment content action from SharePoint & provide necessary details from the previous step; remember we got attachment, we still need to read the data it has & migrate.

Now we want to have individual notes record for each attachment. For example – two attachments will have two notes record. So that we should be able to see all the attachments against a contact record.

Let us now add a Notes record for each attachment of SharePoint. I have mapped the display name of the notes record to be the same as the display name of the attachment.

Please make sure when you map the Document field to use the Base64 encoding.

Base64(outputs('Get_attachment_content')?['body'])

Now to attach this note record to the contact record, one is to use the Regarding field. We have the contact guid / unique identifier from the recently created record.

Alternate way is to use the relate rows action of Dataverse connector

The entire flow should look like this –

After test, the timeline will be populated with attachments & looks like below. I have tested it for images/pdf/excel /txt file.

Happy Migrating!!

Keep reading, keep enjoying, keep exploring!


This was originally posted here.

Comments

*This post is locked for comments