---
title: "Legacy Email Setup with Microsoft EWS"
canonical: "https://help.agiloft.com/space/HELP/43719452/Legacy+Email+Setup+with+Microsoft+EWS"
format: markdown
---
This method sets up email using EWS to meet Microsoft's OAuth 2.0 authentication requirements. If possible, it's better to set up email with [Microsoft Graph](https://agiloft-public.atlassian.net/wiki/spaces/HELP/pages/43719418) or [Microsoft OAuth 2.0](https://agiloft-public.atlassian.net/wiki/spaces/HELP/pages/43719342), because those options are more secure and allow both inbound and outbound authentication. However, if you can't use one of those methods for some reason, you can use this method to authenticate inbound email.

> ℹ️ **Prerequisites**
> ℹ️ 
> ℹ️ This authentication method requires an Entra ID account and an [Entra ID tenant](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-create-new-tenant). The account must be a tenant administrator.

# Register Agiloft in Entra

First, you need to register Agiloft with Entra. As you follow the steps, you can also refer to [Microsoft's setup instructions](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) if any of the options you see differ from those described here.

1. Sign in to the [Entra portal](https://entra.microsoft.com/) with the appropriate organization account.
2. If your account has access to multiple tenants, select your account in the upper right corner and set your session to the appropriate AD tenant. For more information about tenants, see [Microsoft's tenant documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-create-new-tenant).
3. Go to **Identity > Applications > App registrations** and select New registration.
4. Enter a name for the registration. For example, you might name your registration "Agiloft Application for OAuth2."
5. Select an option for who can use the application. This choice depends on the security policy for your organization. You may need to check with your IT department. If you created an Entra account and tenant only for testing purposes, you could select "Accounts in this organizational directory only."
6. Leave the default Redirect URI settings.
7. Click Register. The portal automatically directs you to the overview page for the Agiloft application.

With the application registered, you can gather the necessary identifying information to use the application with Entra as an authentication tool.

1. In the sidebar, click Certificates & secrets.
2. Click New client secret.
3. Give the Client Secret a descriptive name, such as "Agiloft EWS Integration."
4. Set it to the maximum expiration of 24 months.
5. Click Add. The secret now appears in the list.
6. Copy the secret's value into a note or document. Make sure to take the value, not the ID.
7. In the portal sidebar, click Overview to return to the overview page for the application.
8. Copy the Application ID value into your note. This is the Client ID you need in Agiloft.
9. Copy the Directory ID value into your note. This is the Tenant ID you need in Agiloft.

Before you leave the portal, add access permission for the application:

1. Inside your Agiloft app registration, click Manifest on the sidebar.
2. Locate the `requiredResourceAccess` property in the manifest and add the following inside the square [] brackets, at the bottom of the list of properties. Note that the comma at the top should be positioned next to the last `}` in the existing code, so that in the finished product you have a line reading `},` and then the rest of the code being added.

> ⚠️ Take a moment to double check your work and make sure the code has been added in the correct location, as described. Adding this code incorrectly is a common mistake.

3. Click Save.
4. Click API permissions in the sidebar.
5. Confirm the `full_access_as_app` permission is listed.
6. Click Grant admin consent, located next to the Add a permission button.

# > Macro (anchor)

Set Up Inbound Email

> Macro (include)

1. Go to **Setup > Email and SMS > Inbound Email Accounts**. This list includes all existing inbound email accounts for all tables.
2. Edit the demo configuration for Contract. If you've already configured Contract and are adding another inbound account, select a different demo configuration to modify or click New to create a new configuration.
3. On the Table tab, if the table isn't already selected because this is a new configuration, select the table that will receive inbound email. If you're editing an existing configuration, the table is already selected.
4. Click Next.
5. On the Server tab:
  1. Select IMAP.
  2. Enter `EWS:outlook.office365.com/ews/Exchange.asmx` for the address.
  3. Enable SSL/TLS connection.
  4. Set the custom port option to 443.
6. On the Account tab:
  1. Enter the full email address. If you're using a shared mailbox, enter the shared mailbox address.
  2. Leave the password field empty.
  3. Enter the Tenant ID, Client ID, and Client Secret you copied from your Entra application page.
7. If you need to access multiple mailboxes with this configuration, you can do so on the Account tab with the Additional Users field. In the field, enter each additional email address, separating addresses with semicolons. For example: `email1@email.com; email2@email.com; email3@email.com`
8. Go to the last tab and click Finish.

If you want to set up an inbound account for another table, repeat the steps above. If you've finished setting up inbound accounts, see [Recommended Email Setup](https://agiloft-public.atlassian.net/wiki/spaces/HELP/pages/43719340).

> Macro (hide-if)
> 
> #### Related articles
> 
> > Macro (contentbylabel)