Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

EWS has started returning 401 Authorisation Error to outlook email requests but user-id and password are still valid

$
0
0

i raised this question on Microsoft Online Services  >  Microsoft Online: Exchange Online and after almost one week your colleague advised me to re-post on this thread. Please see issue below. Since raising initial issue it is confirmed from my IT department that they have made no changes on my application server, so i would like to know if anything has changed on your side (see below for more info):

Original post: 18 Sep:

Nothing has changed in the application software. The user account is not changed and has been working fine. Password is still valid and not changed. Then on Sep 11 I started getting authorisation errors 401 each time i tried to send or fetch emails.

Key code snippets (code not recently changed and it has worked fine for year(s) now, but suddenly errors started appearing):

emc = New ExchangeService(ExchangeVersion.Exchange2013_SP1)
emc.Credentials = New WebCredentials(eMailUserName, pwd)     
emc.Url = New Uri("https://outlook.office365.com/EWS/Exchange.asmx")

Dim MyMsg As New EmailMessage(emc)
MyMsg.Subject = eMailSubject
MyMsg.Body = eMailHTMLbody
MyMsg.ToRecipients.Add(eMailTo)MyMsg.Importance = Importance.High
MyMsg.From = New EmailAddress(MyEmailAddress)
MyMsg.ReplyTo.Add("NoReply." & MyEmailAddress)
MyMsg.Send()

Fails at this point with Error Code: The request failed. The remote server returned an error: (401) Unauthorized.

   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
   at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
   at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable`1 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
   at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
   at Microsoft.Exchange.WebServices.Data.EmailMessage.InternalSend(FolderId parentFolderId, MessageDisposition messageDisposition)
   at Microsoft.Exchange.WebServices.Data.EmailMessage.Send()
   at ....

Please advise if there is something that has changed in outlook EWS from 11 September onwards. I cannot find any relevant article or info via google. 

I am also checking with our IT department if they have made any changes. There was a discussion around certificates - could this have anything to do with it if the server certificate has been changed?

Anyway, please advise from your side.

Thanks, Keith227


Keith227


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>