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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Adding array of attach...
Power Automate
Answered

Adding array of attachments to an email from SharePoint Document Library

(0) ShareShare
ReportReport
Posted on by 271

I'm trying to build a flow that adds an assortment of files in a SharePoint document library to an email. I've found several posts that provide similar examples of this process, but none of them are working for me. I've tried both Get File Content and Get File Content Using Path. In both cases I keep receiving a 404 error. Here's my flow:

MarcusD1_0-1674771720971.png

 

And here's the error I'm receiving (with additional content below)

MarcusD1_1-1674771843477.png

The info is all included in the File Path output - so I don't understand why the flow is generating a 404 - file not found error?

 

"{Link}": "https://[mydomain].sharepoint.com/sites/[mysite]/Shared%20Documents/Testing/Registering%20for%20a%20User%202.0%20Account.pdf",
"{Name}": "Registering for a [user] Account",
"{FilenameWithExtension}": "Registering for a [user] Account.pdf",
"{Path}": "Shared Documents/Testing/",
"{FullPath}": "Shared Documents/Testing/Registering for a [user Account.pdf",
"{IsCheckedOut}": false,
"{VersionNumber}": "1.0"

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    This is how I would do it.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_9-1674781452017.png

     

    I'm not sure what your trigger is, but I've just used a Recurrence to trigger the flow daily.

    grantjenkins_10-1674781800040.png

     

    Get files retrieves all the images from a specific folder in my Documents Library.

    grantjenkins_11-1674781872680.png

     

    Initialize variable creates an array variable called attachments that will eventually contain all of our images.

    grantjenkins_12-1674781921849.png

     

    Condition checks to see if our Get files actually returned any items (images existing in the folder). The expression used is:

    length(outputs('Get_files_(properties_only)')?['body/value'])

    grantjenkins_13-1674782013814.png

     

    If at least one item returned, then we go into the Yes branch.

     

    Apply to each iterates over each of the files returned.

    grantjenkins_14-1674782062535.png

     

    Get file content uses the Identifier from Get items to return the file content.

    grantjenkins_15-1674782102294.png

     

    Append to array variable then appends the below object to our attachments array. The expression used to build the object is:

    {
     "Name": @{items('Apply_to_each')?['{FilenameWithExtension}']},
     "ContentBytes": @{body('Get_file_content')}
    }

    grantjenkins_16-1674782181160.png

     

    Lastly, after the Apply to each loop has completed, we Send an email with the attachments.

    grantjenkins_17-1674782229128.png

     

    We should then have an email with all of our images attached.

    grantjenkins_18-1674782374756.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • Verified answer
    MarcusD1 Profile Picture
    271 on at

    Found the solution / information I needed in this excellent video: https://www.youtube.com/watch?v=9G9GNeknemg

     

    I had a couple of issues, and in particular selecting the file "ID" instead of the "Identifier", as well as the Filename vs. the Filename with extension.

  • MarcusD1 Profile Picture
    271 on at

    You identified the key elements I was missing as well. Thanks @grantjenkins 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 862

#2
Valantis Profile Picture

Valantis 738

#3
Haque Profile Picture

Haque 553

Last 30 days Overall leaderboard