0

I am making a power app to send email with multiple attachments.

It sends email with 1 attachment control.

Office365Outlook.SendEmailV2(
"[email protected]",
"Subject",
"Body",
{
    Attachments: ForAll(
        Attachment_Inspection_Record.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        }
    )
})

I have 5 attachment controls.

There is an error if send email with 5 attachment control attachment:

Office365Outlook.SendEmailV2(
"[email protected]",
"Subject",
"Body",
{
    Attachments: ForAll(
        Attachment_Inspection_Record.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        },
        Attachment_CCM.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        },
         Attachment_Sitephoto_1.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        }
        Attachment_Sitephoto_2.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        }
        Attachment_Sitephoto_3.Attachments,
        {
            ContentBytes: Value,
            Name: Name
        }
    )

    
});

1 Answer 1

1

The ForAll function can be used to transform a table into another - but what you are trying to do is to combine (union) multiple tables, which is not what it does. You can use the Table function to do that - either combining all the attachment controls at first, then using ForAll to extract the name/content, or combining the extracted values that you have working for one control.

For example, the first option would be similar to the expression below:

Office365Outlook.SendEmailV2(
    "[email protected]",
    "Subject",
    "Body",
    {
        Attachments: ForAll(
            Table(
                Attachment_Inspection_Record.Attachments,
                Attachment_CCM.Attachments,
                Attachment_Sitephoto_1.Attachments,
                Attachment_Sitephoto_2.Attachments,
                Attachment_Sitephoto_3.Attachments
            ),
            {
                ContentBytes: Value,
                Name: Name
            }
        )
    }
);

While the second would be similar to this:

Office365Outlook.SendEmailV2(
    "[email protected]",
    "Subject",
    "Body",
    {
        Attachments: Table(
            ForAll(
                Attachment_Inspection_Record.Attachments,
                {
                    ContentBytes: Value,
                    Name: Name
                }
            ),
            ForAll(
                Attachment_CCM.Attachments,
                {
                    ContentBytes: Value,
                    Name: Name
                }
            ),
            ForAll(
                Attachment_Sitephoto_1.Attachments,
                {
                    ContentBytes: Value,
                    Name: Name
                }
            ),
            ForAll(
                Attachment_Sitephoto_2.Attachments,
                {
                    ContentBytes: Value,
                    Name: Name
                }
            ),
            ForAll(
                Attachment_Sitephoto_3.Attachments,
                {
                    ContentBytes: Value,
                    Name: Name
                }
            )
        )
    }
);

Both should work fine.

Sign up to request clarification or add additional context in comments.

1 Comment

It works, thank you very much for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.