@gboto1983
I appreciate you introducing a completely new topic, which helped me learn some new things today. After struggling for two hours, I finally managed to get it to work.
Here are the steps you need to follow:
1. Create a new list to store all the attachments.
2. Utilize the "get files in folder" function and apply the necessary filters.
3. Iterate through the list of files using a loop.
4. Create a variable called "AttachmentList" and initialize it with an empty value.
5. Convert all the files into binary format since Office365 requires email attachments to be in bytes data format.
6. Then, add the filename and binary data into a custom object.
7. Add the custom object into the list.
8. Once the loop is complete, assign the list to the attachment parameter.


Code:
Variables.CreateNewList List=> ListFileName
Folder.GetFiles Folder: $'''C:\\Boot\\txt''' FileFilter: $'''*txt''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
LOOP FOREACH CurrentItem IN Files
SET AttachmentList TO $'''%''%'''
File.ConvertToBinary File: CurrentItem.FullName BinaryData=> BinaryData
SET AttachmentList TO { 'Name': CurrentItem.Name, 'ContentBytes': BinaryData }
Variables.AddItemToList Item: AttachmentList List: ListFileName
END
@@'emailMessage/Sensitivity': ''
@@connectionDisplayName: 'Office 365 Outlook PADDemo-16763'
External.InvokeCloudConnector Connection: 'd6a85e0c-93e8-42a2-8c1d-076c8fb6c19f' ConnectorId: '/providers/Microsoft.PowerApps/apis/shared_office365' OperationId: 'SendEmailV2' @'emailMessage/To': $'''deenu@gmail.com''' @'emailMessage/Subject': $'''Multiple attachments''' @'emailMessage/Body': $'''PFA documents for your reference.
Thanks,
Deenu''' @'emailMessage/From': $'''deenu@microsoft.com''' @'emailMessage/Attachments': ListFileName
Thanks,
Deenuji Loganathan 👩💻
Automation Evangelist 🤖
Follow me on LinkedIn 👥
-------------------------------------------------------------------------------------------------------------
If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀