Office.MailboxEnums.RecipientType enum

指定消息或约会收件人的类型。

注解

API 集:邮箱 1.1

适用的 Outlook 模式:Compose 或 Read

重要提示recipientTypeOffice.context.mailbox.item.from.getAsyncOffice.context.mailbox.item.organizer.getAsync 方法不会返回属性值。 电子邮件发件人或约会组织者始终是电子邮件地址在 Exchange 服务器上的用户。

使用方

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-to-message-read.yaml

const msgTo = Office.context.mailbox.item.to;
const distributionLists = [];
const externalRecipients = [];
const internalRecipients = [];
const otherRecipients = [];
for (let i = 0; i < msgTo.length; i++) {
    switch (msgTo[i].recipientType) {
    case Office.MailboxEnums.RecipientType.DistributionList:
        distributionLists.push(msgTo[i]);
        break;
    case Office.MailboxEnums.RecipientType.ExternalUser:
        externalRecipients.push(msgTo[i]);
        break;
    case Office.MailboxEnums.RecipientType.User:
        internalRecipients.push(msgTo[i]);
        break;
    case Office.MailboxEnums.RecipientType.Other:
        otherRecipients.push(msgTo[i]);
    }
}

if (distributionLists.length > 0) {
    console.log("Distribution Lists:");
    distributionLists.forEach((recipient) => console.log(`${recipient.displayName}, ${recipient.emailAddress}`));
}

if (externalRecipients.length > 0) {
    console.log("External Recipients:");
    externalRecipients.forEach((recipient) => console.log(`${recipient.displayName}, ${recipient.emailAddress}`));
}

if (internalRecipients.length > 0) {
    console.log("Internal Recipients:");
    internalRecipients.forEach((recipient) => console.log(`${recipient.displayName}, ${recipient.emailAddress}`));
}

if (otherRecipients.length > 0) {
    console.log("Other Recipients:");
    otherRecipients.forEach((recipient) => console.log(`${recipient.displayName}, ${recipient.emailAddress}`));
}

字段

DistributionList = "distributionList"

指定收件人是包含电子邮件地址列表的通讯组列表。

User = "user"

指定收件人是 Exchange 服务器上的 SMTP 电子邮件地址。

ExternalUser = "externalUser"

指定收件人是不在 Exchange 服务器上的 SMTP 电子邮件地址。 它还指从个人 Outlook 通讯簿添加的收件人。

重要提示:在 Outlook 网页版 中,Windows (从版本 2210 内部版本 15813.20002) ) 开始的新 (和经典,在 Mac 上,保存到个人通讯簿的全局通讯簿 (GAL) 收件人返回该ExternalUser值,即使他们的 SMTP 电子邮件地址显示在 Exchange 服务器上也是如此。 仅当直接添加或针对 GAL 解析值时,收件人才会返回 User 值。

Other = "other"

指定收件人不是其他收件人类型之一。 它还指未根据 Exchange 通讯簿解析的收件人,因此被视为外部 SMTP 地址。

重要提示:在 Android 和 iOS 上的 Outlook 中,全局通讯簿 (GAL) 保存到个人通讯簿 Other 的收件人返回该值,即使他们的 SMTP 电子邮件地址显示在 Exchange 服务器上也是如此。 仅当直接添加或针对 GAL 解析值时,收件人才会返回 User 值。