发送带有附件的电子邮件

问题描述 投票:0回答:1

我正在制作一个强大的应用程序来发送带有多个附件的电子邮件。

它发送带有 1 个附件控件的电子邮件。

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

我有 5 个附件控件。

如果发送带有 5 个附件控制附件的电子邮件,则会出现错误:

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

    
});
email outlook powerapps email-attachments powerapps-canvas
1个回答
1
投票

ForAll
函数可用于将一个表转换为另一个表 - 但您想要做的是组合(联合)多个表,这不是它的作用。您可以使用
Table
函数
来执行此操作 - 首先组合所有附件控件,然后使用 ForAll 提取名称/内容,或者组合为一个控件工作的提取值。

例如,第一个选项将类似于以下表达式:

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

第二个与此类似:

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

两者都应该可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.