The request failed. The remote server returned an error: (401) Unauthorized.

Odene Gerber 0 Reputation points
2023-10-26T07:04:38.6333333+00:00

Hi,

Trying to connect to the EWS - The request failed. The remote server returned an error: (401) Unauthorized. - is the error message.

Using the TestConnectivity test, the error is the below code.

My problem is, my mails are hosted with Office itself and I cannot seem to find a solution.

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,173 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,349 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
526 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amit Singh 4,866 Reputation points
    2023-10-31T03:47:47.21+00:00

    Try to disable MFA and check.

    Basic authentication in now disabled by default in Office 365, so you should avoid using it. Look at implementing oAuth in your see code https://video2.skills-academy.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth

    0 comments No comments