Office.Contact interface

Warning

This API is now deprecated.

Use regular expression rules instead.

Represents the details about a contact (similar to what's on a physical contact or business card) extracted from the item's body. Read mode only.

The list of contacts extracted from the body of an email message or appointment is returned in the contacts property of the Entities object returned by the getEntities or getEntitiesByType method of the current item.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

Remarks

Minimum permission level: restricted

Applicable Outlook mode: Read

Important: Entity-based contextual Outlook add-ins will be retired in Q2 of 2024. The work to retire this feature will start in May and continue until the end of June. After June, contextual add-ins will no longer be able to detect entities in mail items to perform tasks on them. The following APIs will also be retired.

  • Office.context.mailbox.item.getEntities - Office.context.mailbox.item.getEntitiesByType - Office.context.mailbox.item.getFilteredEntitiesByName - Office.context.mailbox.item.getSelectedEntities

To help minimize potential disruptions, the following will still be supported after entity-based contextual add-ins are retired.

  • An alternative implementation of the Join Meeting button, which is activated by online meeting add-ins, is being developed. Once support for entity-based contextual add-ins ends, online meeting add-ins will automatically transition to the alternative implementation to activate the Join Meeting button.

  • Regular expression rules will continue to be supported after entity-based contextual add-ins are retired. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

For more information, see Retirement of entity-based contextual Outlook add-ins.

Examples

const item = Office.context.mailbox.item;
// Get an array of strings that represent contacts in the current item's body.
const contacts = item.getEntitiesByType(Office.MailboxEnums.EntityType.Contact);
console.log("There are " + contacts.length + " contacts.")
contacts.forEach(function (contact) {
    console.log("Person name: " + JSON.stringify(contact.personName));
    console.log("Business name: " + JSON.stringify(contact.businessName));
    console.log("Addresses: " + JSON.stringify(contact.addresses));
    console.log("Phone numbers: " + JSON.stringify(contact.phoneNumbers));
    console.log("Email addresses: " + JSON.stringify(contact.emailAddresses));
    console.log("Urls: " + JSON.stringify(contact.urls));
});

/* Example email that includes contact details of sender, John Smith:
Hi there,
I have received the package.

Thanks.
John Smith
Account Manager
Contoso Corporation
1 Contoso Way, Redmond, WA 98052
[email protected]
111-111-1111
https://contoso.com/john.smith
*/

Properties

addresses

An array of strings containing the mailing and street addresses associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

businessName

A string containing the name of the business associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

emailAddresses

An array of strings containing the SMTP email addresses associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

personName

A string containing the name of the person associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

phoneNumbers

An array containing a PhoneNumber object for each phone number associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

urls

An array of strings containing the Internet URLs associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

Property Details

addresses

Warning

This API is now deprecated.

Use regular expression rules instead.

An array of strings containing the mailing and street addresses associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

addresses: string[];

Property Value

string[]

businessName

Warning

This API is now deprecated.

Use regular expression rules instead.

A string containing the name of the business associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

businessName: string;

Property Value

string

emailAddresses

Warning

This API is now deprecated.

Use regular expression rules instead.

An array of strings containing the SMTP email addresses associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

emailAddresses: string[];

Property Value

string[]

personName

Warning

This API is now deprecated.

Use regular expression rules instead.

A string containing the name of the person associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

personName: string;

Property Value

string

phoneNumbers

Warning

This API is now deprecated.

Use regular expression rules instead.

An array containing a PhoneNumber object for each phone number associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

phoneNumbers: PhoneNumber[];

Property Value

urls

Warning

This API is now deprecated.

Use regular expression rules instead.

An array of strings containing the Internet URLs associated with the contact. Nullable.

Warning: Entity-based contextual Outlook add-ins are now retired. However, regular expression rules are still supported. We recommend updating your contextual add-in to use regular expression rules as an alternative solution. For guidance on how to implement these rules, see Contextual Outlook add-ins.

urls: string[];

Property Value

string[]