ex_login_O365_OAuth

Login to Office 365 with OAuth using EWS

Member of namespace

Ewsmail

Syntax

bool ex_login_O365_OAuth (string clientId, string  tenantId, string username, string password)

Parameters

clientId
Type: string
Application (client) ID from Azure Active Directory - App registrations
tenantId
Type: string
Directory (tenant) ID from Azure Active Directory - App registrations
username
Type: string
Username of Office 365 account
password
Type: string
Password of Office 365 account

All parameters support smart parameters.

Parameters (clientId, tenantId, username, password) can be encrypted by storing it in the Advanced section of the Custom tab in the Application Manager.

To retrieve parameters that is stored in the Advanced section, use a smart parameter for the action's parameters similar to @APPVAR(values/adv/password) where password is the name entered for the value in the Application Manager.

Returns

True if the login succeeds. Otherwise, False.

Level

Batch level, open event.

Details

*** This Action Is Deprecated ***

This action has been deprecated and is scheduled to be removed in a future release. It is recommended that you no longer use this action.

To use OAuth authentication service provided by Azure Active Directory to enable EWS to access Exchange Online in Office 365, you will need to:

  1. Register application with Azure Active Directory.
  2. For Authentication, under "Default client type", set "Yes" to "Treat application as a public client."
  3. For API permissions, add "Exchange - EWS.AccessAsUser.All" and grant consent.
Example:
ex_login_O365_OAuth("00000000-0000-0000-0000-000000000000", "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "user@organization.com", "@APPVAR(values/adv/password)")
ex_scan()
ex_logout()
If more than one logins (ex_login, ex_login_O365_OAuth or ex_login_O365_OAuth_ClientSecret) are used, second action will be ignored unless authentication fails/expires or ex_logout() was used before the second action to disconnect.