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

  • Question

  • 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

    Friday, May 8, 2015 12:56 PM

All replies

  • Hi Chris,

    Make sure that the WebCredentialObject is defined as below

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


    Regards from Visit ExchangeOnline | Visit WindowsAdmin

    Friday, May 8, 2015 1:03 PM
  • 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.
    Friday, May 8, 2015 3:27 PM
  • It turned out to be an incorrectly typed password.
    Friday, May 8, 2015 3:54 PM