Skip to main content

Notifications

Working with Image and File Types in Dataverse(CDS)

Image and File Column Data Types are great addition to the Dataverse (CDS) but I found it a little bit hard and tricky to deal with them using power automate so I will be detailing below how to deal with them in terms of:

 

1. Uploading an Image , a common scenario when it is passed from power apps or through third Party Integration.

2. Downloading a File attachment and sending it as email.

 

How this fields are created in Data Verse?

1. Go to make.powerapps.com

2. Click on Solutions-> Add new solution -> Add your table to the solution

3. Open your Table for Example: Account Table -> Click Add Column and then choose field type as Image or File

Mira_Ghaly_0-1611910588900.pngMira_Ghaly_1-1611910647306.png

4. Go to your Form and add the drag and drop the 2 columns on the form, Save and Publish form.

Mira_Ghaly_2-1611910760570.png

 

 

Then you can open your form and choose the file for your image and file.

Mira_Ghaly_4-1611910906327.png

 

So Let's get started by Uploading Image Using Power Automate, for the sake of this article I will be using a Manual Trigger:

 

So there is a very clear action on the CDS(Current Environment Connector) called Upload File or Image Content and to my surprise it looked super easy and clear.

 

Parameters:

Entity name: Select your Table Name(Accounts)

Item ID: Selected account id to which the image will be uploaded

Field Name: To select your Image or File Attribute Column Name

Content :???????????????? And here it come to the tricky part , I tried to pass base64 directly and it didn't work , after a little bit of working around it I found the Trick; Content Parameter needs to be passed in the format below for PNG images:

{
"$content-type": "image/png",

"$content":base64string

}

 

Mira_Ghaly_0-1611911139044.png

Mira_Ghaly_1-1611911522608.png

 

Run the workflow and tested it and the image came beautifully on the form as below:

Mira_Ghaly_2-1611911628806.png

 

Now comes the part where we want to download the Image/File and send it as attachment in an email

 

Mira_Ghaly_3-1611911873671.png

Parameters:

Entity name: Select your Table Name(Accounts)

Item ID: Selected account id to which the image will be uploaded

Field Name: To select your Image or File Attribute Column Name

 

The output of this Action is File or Image Content which we will use in the step below to send email with attachment.

 

Mira_Ghaly_0-1611913655209.png

 

 

Tested the flow and email was sent with the image attached as below:

 

Hope this is useful!Mira_Ghaly_1-1611913830965.png

 

References:

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/file-attributes

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/image-attributes

 

Comments

*This post is locked for comments

  • ajoslin103 Profile Picture ajoslin103 22
    Posted at
    Working with Image and File Types in Dataverse(CDS)

    I can't get DataVerse to stop clipping the image to 144x144 in the record display

     

    I can't get the image downloaded (even when specify 'full') to be anything more than the clipped 144x144

  • Big-Flow-Energy Profile Picture Big-Flow-Energy 6
    Posted at
    Working with Image and File Types in Dataverse(CDS)

    @Mira_Ghaly Amazing - thank you!

  • sroo Profile Picture sroo 890
    Posted at
    Working with Image and File Types in Dataverse(CDS)

    Hi @Mira_Ghaly have you delved deeper with image columns? Odata filters? I am attempting to trigger a flow on Image column changes from a CanvasApp and it's not working out. I have tried with several.