Office.Contact interface
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
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
john.smith@contoso.com
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. |
business |
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. |
email |
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. |
person |
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. |
phone |
An array containing a 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
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
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
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
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
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
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[]
Office Add-ins