Office.MailboxEnums.RecipientType enum

Specifies the type of recipient of a message or appointment.

Remarks

[ API set: Mailbox 1.1 ]

Applicable Outlook mode: Compose or Read

Important: A recipientType property value isn't returned by the Office.context.mailbox.item.from.getAsync and Office.context.mailbox.item.organizer.getAsync methods. The email sender or appointment organizer is always a user whose email address is on the Exchange server.

Examples

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

Fields

DistributionList = "distributionList"

Specifies the recipient is a distribution list containing a list of email addresses.

User = "user"

Specifies the recipient is an SMTP email address on the Exchange server.

ExternalUser = "externalUser"

Specifies the recipient is an SMTP email address that isn't on the Exchange server. It also refers to a recipient added from a personal Outlook address book.

Important: In Outlook on the web, on Windows (new and classic (starting with Version 2210, Build 15813.20002)), and on Mac, Global Address Book (GAL) recipients saved to a personal address book return the ExternalUser value, even if their SMTP email address appears on the Exchange server. Recipients return a User value only if they're directly added or resolved against the GAL.

Other = "other"

Specifies the recipient isn't one of the other recipient types. It also refers to a recipient that isn't resolved against the Exchange address book, and is therefore treated as an external SMTP address.

Important: In Outlook on Android and on iOS, Global Address Book (GAL) recipients saved to a personal address book return the Other value, even if their SMTP email address appears on the Exchange server. Recipients return a User value only if they're directly added or resolved against the GAL.