Office.UserProfile interface
Information about the user associated with the mailbox. This includes their account type, display name, email address, and time zone.
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose or Read
Properties
account |
Gets the account type of the user associated with the mailbox. |
display |
Gets the user's display name. |
email |
Gets the user's SMTP email address. |
time |
Gets the user's time zone in Windows format. The system time zone is usually returned. However, in Outlook on the web and in new Outlook on Windows), the default time zone in the calendar preferences is returned instead. |
Property Details
accountType
Gets the account type of the user associated with the mailbox.
accountType: string;
Property Value
string
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose or Read
The possible account types are listed in the following table.
Value | Description |
---|---|
enterprise | The mailbox is on an on-premises Exchange server. |
gmail | The mailbox is associated with a Gmail account. |
office365 | The mailbox is associated with a Microsoft 365 work or school account. |
outlookCom | The mailbox is associated with a personal Outlook.com account. |
Important:
Volume-licensed perpetual Outlook 2016 doesn’t support the
accountType
property. To work around this, use Exchange Web Services (EWS) to call the ResolveNames operation on the Exchange on-premise server.For hybrid Exchange environments, the returned account type value depends on where the mailbox is hosted. If the mailbox is on an on-premises server, the account type value is enterprise. However, if it's hosted on Exchange Online, the account type value is office365.
Examples
console.log(Office.context.mailbox.userProfile.accountType);
displayName
Gets the user's display name.
displayName: string;
Property Value
string
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose or Read
Examples
// Example: Allie Bellew
console.log(Office.context.mailbox.userProfile.displayName);
emailAddress
Gets the user's SMTP email address.
emailAddress: string;
Property Value
string
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose or Read
Examples
// Example: allieb@contoso.com
console.log(Office.context.mailbox.userProfile.emailAddress);
timeZone
Gets the user's time zone in Windows format.
The system time zone is usually returned. However, in Outlook on the web and in new Outlook on Windows), the default time zone in the calendar preferences is returned instead.
timeZone: string;
Property Value
string
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose or Read
Examples
// Example: Pacific Standard Time
console.log(Office.context.mailbox.userProfile.timeZone);