最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

outlook - Send email with attachment - Stack Overflow

programmeradmin7浏览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
        }
    )

    
});

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
        }
    )

    
});
Share Improve this question edited Jan 22 at 0:48 CommunityBot 11 silver badge asked Dec 9, 2024 at 2:15 Alan TseAlan Tse 597 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论