web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Store File content in ...
Power Automate
Unanswered

Store File content in a variable

(0) ShareShare
ReportReport
Posted on by 187

Hi, I'm trying to work out if it's possible to store the content output of 'get file content' in a variable. Have been trying to do this in a string variable and then add an attachment to an email with the variable in the 'content' part of the attachment but the attachment is not able to be opened when I receive the email.

 

 

Categories:
I have the same question (0)
  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    hi @JamesSnaps  you can apend the variables.

    apend.PNG

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @JamesSnaps 

     

    Try the below.

     

    image.png

     

    Next you need to append the array with filename and content

     

    image.png

     

    Finally add your attachments in your email.

     

    image.png

     

    Note: If you file content type is binary then convert it using base64() expression. Here in my example I am using CDS database which is already getting the document in base64 format.

     

    Thanks

     

  • v-litu-msft Profile Picture
    on at

    Hi @JamesSnaps,

     

    Could you please share the configuration of your Flow by screenshots?

    I think the reason for the received email couldn't open the attachment is the content code format, you could refer to this similar post to learn how to convert the content into base 64 and try it again:

    https://powerusers.microsoft.com/t5/Building-Flows/Send-mail-with-attachment-when-a-new-message-and-file-posted-in/m-p/493138

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • JamesSnaps Profile Picture
    187 on at

    Many thanks, just tested this and works like a treat. Did have to convert to base64, but that's easy enough. Much appreciated.

     

    James

  • Gangula Profile Picture
    77 on at

    I'm facing a similar issue.

    I would like to use a variable to add "File Content" in the "Create file in SharePoint" step.

     

    But the "Dynamic Value" drop-down doesn't show the variable at all.

     

    Variables.jpg

    Create File.jpg

  • TValenzuela Profile Picture
    3 on at

    I wanted to reach out and see if you ever found a solution.  I'm in the same boat where I've created the array variable, appended the file name and content to the array, but when I go to the file contents filed the dynamic content for the variable is not there.

    Edit:  It seems this solution works for email where you can have the attachments field utilize the array.  However, using the array in other areas that are designated for "File Content" doesn't seem to work.  If anyone has a particular solution for that I would love to hear it.  Thanks!

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @TValenzuela 

     

    Try to add a compose action step just above the step. Can you see the Dynamic content you looking for?

     

    Thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard