Add attachments from an attachment control to a collection
// add attachments to a collection from a list
ClearCollect(
AttachCollect // collection name
, AddColumns(
RenameColumns(
<control_name>.Attachments
, "Value"
, "ContentBytes"
) // end RenameColumns
, "@odata.type"
, ""
) // end AddColumns
);
// put the images into a collection for attachment to an email
ClearCollect (
ImageCollection // collection name
,
{ // first image
Name: AddMediaButton1.FileName
, ContentBytes: UploadedImage1.Image
, '@odata.type':""
}
, { // second image
Name: AddMediaButton2.FileName
, ContentBytes: UploadedImage2.Image
, '@odata.type':""
}
);
// remove all blank items
ClearCollect(
FilteredImageCollection,
Filter(ImageCollection, !IsBlank(Name))
);
// attach to the email
{ Attachments: FilteredImageCollection, IsHtml:true }