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 Automate
Unanswered

Send email v2

(2) ShareShare
ReportReport
Posted on by 54
Hi, can you please help me. Got an error attaching multiple files.
 
 
 
 
I have the same question (0)
  • Suggested answer
    Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at
    Hi  ,
     
    The error is occurring because you are sending a list of text values instead of a list of custom objects in your email. Please correct this to resolve the issue.
     
    Regards,
    Deenu
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    As @Deenuji Loganathan pointed out you need to have List of custom objects for the attachments. 

    I would not use list but just set variable.

    Here is how you can make it work:



    Send an email (V2) Attachemnts field put the %Attachments% variable


    Here is code for the actions (other than the Send an email V2 since it has connection reference that would not work on your flow).
    Folder.GetFiles Folder: $'''C:\\Users\\YourUserName\\Documents\\Test''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    SET FirstFile TO True
    LOOP FOREACH CurrentItem2 IN Files
        File.ConvertToBinary File: CurrentItem2 BinaryData=> BinaryData
        IF BinaryData = $'''Byte [0]''' THEN
            # No file. Might be folder so go to next loop.
            NEXT LOOP
        END
        File.GetPathPart File: CurrentItem2.FullName RootPath=> RootPath Directory=> Directory FileName=> FileName FileNameWithoutExtension=> FileNameNoExtension Extension=> FileExtension
        IF FirstFile = True THEN
            SET FirstFile TO False
            SET Attachments TO [{ 'Name': CurrentItem2.Name, 'ContentBytes': BinaryData }]
        ELSE
            SET Attachments TO Attachments + { 'Name': CurrentItem2.Name, 'ContentBytes': BinaryData }
        END
    END
     

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