cancel
Showing results for 
Search instead for 
Did you mean: 
DeviKrishna

Get Files from File Column in Data Verse using Power Automate

Pre-requisites:

 Create a SharePoint Site and a document folder to place the documents.

https://bgsw2022.sharepoint.com/sites/demo/Shared%20Documents/Forms/AllItems.aspx

 

  • Login to https://make.powerapps.com
  • Create a table in Data Verse ‘ProfileDetails’
  • Add a Column(‘ProfileDoc’) of Data type ‘File’

DeviKrishna_0-1650381595658.png

Create few sample records.

DeviKrishna_1-1650381628306.png

 

DeviKrishna_2-1650381638724.png

  • The record got created successfully and the attachment is seen on the file column.
  • Now let’s create a Power Automate flow that will be triggered on create/update of the entity ProfileDetails.
  • Navigate to Solutions-> Create new Solution->Add New->Cloud Flow
  • Follow the below steps,
  • DeviKrishna_3-1650381688454.png

     

  • Click on Save and Test.
  • Open the Run History of Flow. Click on the latest record and open it.

DeviKrishna_4-1650381741011.png

  • Navigate to Get a Row by ID step ->Outputs.
  • Copy the body completely.

DeviKrishna_5-1650381766356.png

  • Add a new step below Get a Row by ID to Parse JSON,
  • Click on Generate from Sample. Copy the body from above step and click on done.
  • Pass the body(‘Get_a_Row_by_ID’) to content

DeviKrishna_6-1650381791144.pngDeviKrishna_7-1650381801119.png

 

  • Add the next step as Microsoft Dataverse trigger , ‘Download a file or an image’
  • Pass the Entity name that has the file column as Table Name.
  • Pass the Row ID that we received from previous step.
  • Choose the column name (File Column).

DeviKrishna_8-1650381828239.png

  • Add the next step as SharePoint trigger – Create File.
  • Pass the Site Address and folder path.
  • Search for the FileName from Dynamic Content parse JSON step.

DeviKrishna_9-1650381855007.png

  • Pass the body(‘Download_a_file_or_an_image’) to the file content.
  • Now save the flow.
  • Create a record to ProfileDetails table. Upload attachment to file column.
  • The flow gets triggered and creates the document in SharePoint.
  • DeviKrishna_10-1650381887021.png

    Flow Complete steps:

  • DeviKrishna_11-1650381903712.png

     

    The flow to get Files from File Column in Data Verse using Power Automate is successfully created.
Comments

Hi, 

I'm trying to send by email several files as attachment from Dataverse file column.   I'm adding records using Canvas App.  Do you know a straightforward way to perform this no requiring Sharepoint?

 

Thanks in advance.

 

Alex

This was extremely helpful, thank you so much @DeviKrishna 

Hi @DeviKrishna 


Thank you so much for sharing the valuable information.

 

Thanks,

Jegan

This helped me figure out what I needed, thank you.

 

All I needed was to get the file name of the file attached in my File Column. If that's all you need, you can skip the json parse and simply write an expression where you need the file name: 

outputs('Get_a_row_by_ID')?['body/columnUniqueName_name']

 

This documentation explains: 

"Each file column has a supporting read-only string column that contains the name of the file. The schema name for this column has the same name as the file column, but has _Name appended to it. So if the schema name is sample_FileColumn, the supporting string column will be sample_FileColumn_Name. The logical name for the supporting column will be sample_filecolumn_name."

Use file column data (Microsoft Dataverse) - Power Apps | Microsoft Learn

 

Also. In my case, the row that has my file column is the same row that triggered my flow. I thought I could get the file name from the output of the trigger but you can't. It only shows up in the output of the "Get a row by ID" action. So it may seem redundant to use Get a row by ID on the same row that triggered the flow but that's how to get the file name information.

@DeviKrishna How would you accomplish this if you have multiple attachments with different file extensions?