Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Moving Files out of Dataverse using Automation tools

(0) ShareShare
ReportReport
Posted on by

Hello Dynamics 365 Fans!

Sometimes you might have a requirement to move data outside of Dynamics, either because of a Business Decision  or because of a previous storage model restriction. In either way, we can use Automation tools to connect to Dataverse and move the  files (attachments) to another location.

We'll be showing some examples to move attachments to Azure Blob Storage.  However, a similar procedure can be used to move data to SharePoint, OneDrive, or to send emails with the attachments.  Also, please note this will NOT reduce the file size of your Dataverse environment, since there are other considerations/fields used for this calculation.  Also, its important to note that this is a Proof of Concept and that before placing this into production, you should test this and confirm the behavior & File availability.

The first part is to trigger the action. I'm also declaring a couple variables to store the FileName and FileContent.  Then, using the Dataverse component to query Dataverse and retrieve the rows of a specific table, on this case, Notes (or Annotation, that stores the notes added within Dataverse)

pastedimage1672674558389v2.png

We can see that at the bottom we have an "apply to each", which will basically allow to move and process each record retrieved from the previous query, in a separated way:

pastedimage1672674769485v3.png

From this previous image, we can see that the first step is to retrieve the details of each record.  If you check the output of this step, you'll get a JSON and this is waht we're going to process on the rest of the steps.  From here, we'll work with the Filename and DocumentBody:

pastedimage1672674931467v4.png

Take note that the DocumentBody contains the Base64 string associated with the file.   That's the reason behind the following steps:

pastedimage1672675117587v5.png

From here, we set the FileName variable as a string containing the GUID of the record, a dash and the original filename.  This will then be transformed (using lowercase function), as Azure Blob Storage has a requirement for files to be Lowercase.  Following this, we get the string associated with the Document Body and we use a transformation step to convert the Base64 string to binary.  Finally, we have a step to store  to the files into a specific location:  A container of our choice with a specific route, and then we set the BlobName as our filename (that will be lowercase) and the BlobContent to our FileContent, as shown in the following picture:

pastedimage1672675306688v6.png

Once our automation executes, we should start to see our folder being populated:

pastedimage1672675465411v7.png

Again, we must reiterate that this is a proof of concept.  Definitive automation should include more steps to validate content, the type of files, for example, as well as extensive test.

Regards

  • Leco Lv Profile Picture
    on at
    RE: Moving Files out of Dataverse using Automation tools

    Hi partner,

    Good point! thanks for sharing.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans