401 Unauthorized exception occurs in Dynamics 365 when using Server-Side Synchronization
Symptoms
When using Server-Side
Synchronization in Dynamics 365, you encounter one of the following errors:
·
The email message "Test Message" cannot be sent. Make
sure that the credentials specified in the mailbox <Mailbox Name> are
correct and have sufficient permissions for sending email. Then, enable the
mailbox for email processing.
·
Appointments, contacts, and tasks can't be synchronized. Make sure
that the credentials specified in the mailbox <Mailbox Name> are correct
and have sufficient permissions. Then, enable the mailbox for appointments,
contacts, and tasks synchronization.
·
Email cannot be received for the mailbox <Mailbox
Name>. Make sure that the credentials specified in the mailbox are correct
and have sufficient permissions for receiving email. Then, enable the mailbox
for email processing.
The message also includes the following error code:
Email
Server Error Code: Http server returned 401 Unauthorized
exception.
Cause
These errors can occur for
one of the following reasons:
1.
The e-mail address of the mailbox record in Dynamics 365 does not
match the e-mail address of the mailbox in Exchange.
2.
If you are using Dynamics 365 (online) with Exchange Online, this
error can occur if you are using an Exchange Server (Hybrid) profile even
though the user's mailbox is located in Exchange Online.
3.
If you are using Dynamics 365 with Exchange Online, this error can
occur if the user does not have an Exchange Online license.
4.
If you are using Dynamics 365 (online) with Exchange Online, this
error can occur if your Dynamics 365 subscription is not in the same Office 365
tenant as your Exchange Online subscription. When using an Exchange Online
email server profile, Dynamics 365 (online) and Exchange
Online need to be in the same Office 365 account/tenant.
5.
If you are using Dynamics 365 (online) with Exchange on-premises,
this error can occur if Basic authentication is not enabled for EWS (Exchange
Web Services).
Resolution
1.
Verify the e-mail address of the mailbox record in Dynamics 365
matches the e-mail address in Exchange. The error includes a link to the
mailbox record in Dynamics 365. You can use this link to quickly verify the
Email Address field.
2.
If you are using Dynamics 365 (online) with Exchange Online, make
sure you are using an Exchange Online email server profile. Only use an
Exchange Server (Hybrid) profile for users that have mailboxes in Exchange
on-premises.
3.
If you are using Dynamics 365 with Exchange Online, verify the
user has an Exchange Online license. For additional information on
assigning licenses in Office 365, see Assign or remove licenses for Office
365 for business.
4.
If you are using Dynamics 365 (online) with Exchange
Online, verify Dynamics 365 (online) and Exchange
Online are in the same Office 365 account/tenant.
5.
If you are using Dynamics 365 (online) with Exchange on-premises,
verify Basic authentication is enabled for EWS (Exchange Web Services).
For more information, see the Prerequisites section of Connect Dynamics
365 (online) to Exchange Server (on-premises).