Office.MailboxEnums.RecipientType enum
指定邮件或约会的收件人类型。
注解
适用的 Outlook 模式:Compose或读取
重要说明: recipientType
属性值不会由 Office.context.mailbox.item.from.getAsync 和 Office.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) ) 开始的 Windows 和经典 (,在 Mac 上,保存到个人通讯簿的全局通讯簿 (GAL) 收件人即使其 SMTP 电子邮件地址出现在 Exchange 服务器上也会返回 |
Other = "other" | 指定收件人不是其他收件人类型之一。 它还指未针对 Exchange 通讯簿解析的收件人,因此被视为外部 SMTP 地址。
重要提示:在 Android 版 Outlook 和 iOS 版中,保存到个人通讯簿的全局通讯簿 (GAL) 收件人返回 |