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

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
About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/