401 error when trying to connect to Office 365 mailbox using EWS Managed API 2.2

Hi,

I am having a problem accessing a mailbox on Office 365 through an Azure worker role application using EWS Managed API 2.2.  This is the error message that I get:

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

It works when using my mailbox, which is also on Office 365, but not when I try to connect to another that is to be used for this application.  Both mailboxes are set up as part of the same corporate account in Office 365, but the domain for mine is [company].com, while the one that doesn't work is [company].net.  EWS has been activated for both addresses.  I can log in in to Outlook Web Access with the other account with no problems, so the login credentials are working.  The strange thing is, it used to work about 2 months ago when I originally built the application and was testing.  I hadn't tried to use it since then until yesterday, when I was testing it before deploying to production.

Are there any other settings that I can check that would prevent EWS from working for the other mailbox?

Thanks,

Chris

May 8th, 2015 8:58am

Hi Chris,

Make sure that the WebCredentialObject is defined as below

New-Object -TypeName Microsoft.Exchange.WebServices.Data.WebCredentials("SamAcctName", "Password", "NetBIOSDomain")

Free Windows Admin Tool Kit Click here and download it now
May 8th, 2015 9:05am

Hi,

I've tried both formats, but WebCredentials([EmailAddress], [Password]) is the only one that works for Office 365.  It works with my Office 365 mailbox, so there must be something about the settings for the other mailbox that is different.  Thanks, though.
May 8th, 2015 11:29am

It turned out to be an incorrectly typed password.
Free Windows Admin Tool Kit Click here and download it now
May 8th, 2015 11:56am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics