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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Add Image to SharePoint library from URL or Attachement

(1) ShareShare
ReportReport
Posted on by 107

Hello, 

 

I have a image that I want to upload to sharepoint, and then use the name and path in future steps in the same flow. The trigger occurs when an email is received. I can either have the image come in as an attachment with the email, or I can have it come in the body of the email as a URL. 

 

As an attachment attempt:

So far, the most success I have had is using the create file step and grabbing the attachment name and content. In this case I am able to successfully add the attached image to my SharePoint library. Unfortunately when I do this, it creates an Apply to Each step around the Create File step. I say unfortunately, because after this is completed, I want to grab the path of the newly created file and use it in my next step. But the outputs from the Create File are not available, only the "Apply to Each" output is shown. In this case, I realize I somehow have to isolate the attachment so I can retrieve the outputs, I just don't know how to do it. 

 

Something to note, there will never be more than 1 attachment or URL that would be coming from the triggered email received. 

 

Any help would be most appreciated! 

I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    on at
    Re: Add Image to SharePoint library from URL or Attachement

    Hi @Shaebert ,

     

    You could use first or [0] to get the first attachment.

    vbofengmsft_0-1675650641389.png

    triggerOutputs()?['body/attachments'][0]['contentBytes']

     

    Best Regards,

    Bof

     

  • Shaebert Profile Picture
    107 on at
    Re: Add Image to SharePoint library from URL or Attachement

    Thanks for this idea, I tried it out and got the following error:

     

    Unable to process template language expressions in action 'Create_file' inputs at line '0' and column '0': 'The template language expression 'triggerOutputs()?['body/attachments'][0]['contentBytes']' cannot be evaluated because property 'contentBytes' doesn't exist, available properties are '@odata.type, id, lastModifiedDateTime, name, contentType, size, isInline'. Please see https://aka.ms/logicexpressions for usage details.'.
  • v-bofeng-msft Profile Picture
    on at
    Re: Add Image to SharePoint library from URL or Attachement

    Hi @Shaebert ,

     

    Could you please show me your flow?

     

    Best Regards,

    Bof

  • Shaebert Profile Picture
    107 on at
    Re: Add Image to SharePoint library from URL or Attachement

    I figured out the problem. I was testing with an email that didn't have an attachment. Works, great, thank you!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard