cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Converting email attachment to base64 string

Hi i have a flow where attachments from email should send to api in base64 format i'm using apply to each im calling my api in apply to each where in im sending attachment content as base64 string to my api but it is not working i tried to use binary() in expression but attachment content is not showing to keep in binary expresssion so i tried typing binary(attachmentcontent) as value for my api but its not working can anyone provide solution for this i need to send multiple attachments from mail as base64 string to api.Thanks in Advance 🙂.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi @v-litu-msft  My issue got resolved yesterday anyways thanks for your suggestion and quick response i used byte data type and used attachments content as value in byte data type it works fine.

View solution in original post

6 REPLIES 6
Community Support
Community Support

Hi @Anonymous,

 

You could use the base64() function convert the Email attachment into base64, if you have multiple attachments, and want to send them all together, you could initialize an array variable, then use the Append to array variable to extract each attachment and store it:

Annotation 2020-04-21 105031.png

 

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.

Anonymous
Not applicable

Hi @v-litu-msft thanks for your suggestion  i'm sending one by one not all at a time to my api can you show me your expression clearly ? what i should do is i should initialize variable and in apply to each by using set variable in the value section of set variable i'm writing the expression what you said and im using that variable to my api i think the expression is wrong can you show me expression clearly or i should write directly expression in my base64 api value can i see your expression ?.

Hi @Anonymous,

 

Sorry, there is the completed expression:

base64(body('Get_Attachment_(V2)')?['contentBytes'])

 

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.

Anonymous
Not applicable

Hi

Hi @Anonymous,

 

Could you confirm the content type if it has a value? I test on my side but it works correctly.

Annotation 2020-04-22 171749.png

 

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.

Anonymous
Not applicable

Hi @v-litu-msft  My issue got resolved yesterday anyways thanks for your suggestion and quick response i used byte data type and used attachments content as value in byte data type it works fine.

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (5,719)