HTTP status 401: Unauthorized When Calling GetEWSClient

HI

When Running the following code:

        Dim AssistEmailAddress As String = strEmail
        Dim AssistEmailPassword As String = strEmailPass

        Dim Credentials As New NetworkCredential(AssistEmailAddress, AssistEmailPassword)
        ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf RemoteCertificateValidationHandler)
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

        Client = EWSClient.GetEWSClient(MailboxURI, Credentials)

I get the error:

“The request failed with HTTP status 401: Unauthorized”

It was working a day ago, and nothing with regards to the code or the email account has changed.

@dpivo

Please try the latest version of Aspose.Email for .NET 22.9. Hope this helps you.

If you still face problem, please use the attached code example. It uses modern authentication.
EWSModernAuthenticationApp.zip (3.4 KB)

To use modern authentication, please make sure that it is enabled. Modern authentication is enabled by default in Exchange Online.

A post was split to a new topic: 401: Unauthorized When Calling GetEWSClient