Forum Discussion

MichaelDenmark's avatar
MichaelDenmark
Copper Contributor
Aug 25, 2022

EWS with oAuth "An internal server error occurred. The operation failed."

Hi...

 

Since yesterday, my synchronization application starts throwing exceptions with the following error

 

"An internal server error occurred. The operation failed."

 

It only happen for mailboxes when I authenticatate with oAuth (CreateWithApplicationOptions).

 

Has anyone experienced the same and found a solution?

 

 

Tracing the call:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">*</Action>
</s:Header>
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInternalServerError</faultcode>
<faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

  • MichaelDenmark's avatar
    MichaelDenmark
    Copper Contributor

    I've found out that the problem can be solved by added a header after setting ImpersonalteUserId

     

    service.HttpHeaders.Add("X-AnchorMailbox", mailbox.Mailbox);

     

    • nsgsanna's avatar
      nsgsanna
      Copper Contributor
      This also resolved it for us.
      The error message is extremely unhelpful and why is it needed is a mystery, but al least it's solved.
      • onlyconnect's avatar
        onlyconnect
        Copper Contributor
        Same here, thanks so much for posting. I wish there were another way to access the Exchange Online public folders programmatically ...
  • anconam's avatar
    anconam
    Copper Contributor

    MichaelDenmark 
    We are experiencing the same. Logs in our product show that this error had a surge over the past week. Seems like a problem with MS.

     

     

  • MikeCoop's avatar
    MikeCoop
    Copper Contributor

    Same here, we are already using:

    ewsClient.HttpHeaders.Add("X-AnchorMailbox", "{emailAddress}")

     

    We've been getting this error for a few days now:

    "Microsoft.Exchange.WebServices.Data.ServiceResponseException: An internal server error occurred. The operation failed."

     

    It happens when calling the function:

    ewsClient.ResolveName(searchStr, ResolveNameSearchLocation.DirectoryOnly, True)

     

    The console application is running from an Azure VM.

     

    The strange thing is, when I run the same application from my laptop locally, it works. No error.

     

    MichaelDenmark 

    • Kevin Brannon's avatar
      Kevin Brannon
      Copper Contributor

      Same error here, but only intermittently. Odd that it cropped up seemingly just this week.

      • Thinkjohn's avatar
        Thinkjohn
        Copper Contributor

        i am getting same error as well. I already include the header for the impersonated mailbox. 

        It is intermittent but often enough that it is a serious problem. 

        please post back if you find a solution.  

    • niteshdashore's avatar
      niteshdashore
      Copper Contributor

      MikeCoop   I am alos getting the same error. Its working locally and getting this issue on server randomly.  I will suggest you to open a ticket on microsoft.

  • MacieKorte's avatar
    MacieKorte
    Copper Contributor

    Our QA team has noticed this problem happening recently as well (started reporting Aug 29, 2022 but it probably started earlier than that).  The issue is still ongoing for us.  

    • MacieKorte's avatar
      MacieKorte
      Copper Contributor

      This error has stopped happening for us this week.  QA has verified that it is no longer occurring over multiple days.  We made no change on our side, so it was definitely a change on the Microsoft side which caused it and resolved it.  

  • McCrayMA's avatar
    McCrayMA
    Copper Contributor
    Same thing here. We have multiple customers reporting this and we have experienced it ourselves. One customer elected to go back to UserID/Password, but that will only work until 10/1. We need an answer/update from Microsoft....
  • Mikhail295's avatar
    Mikhail295
    Copper Contributor

    I have the same issue.
    And I discovered null prefix in token string in trace of EwsRequest:

    ...wsse:Security soap:mustUnderstand='1'> nulleyJ0eXAiOiJK...

    • Sorin332's avatar
      Sorin332
      Copper Contributor

      prestonsbutler Mikhail295 MichaelDenmark 

       

      We have a working app using Basic Authentication and we migrated to Oauth 2 but we receive this error from EWS.

       

      Uncaught SoapFault exception: [a:ErrorInternalServerError] An internal server error occurred. The operation failed.


      Our app was implemented long time ago in PHP using php-ews library, so we updated the library to this one which supports Oauth 2.
      We generated the token using their api https://login.microsoftonline.com/{{tenant_id}}/oauth2/token and client_credentials flow since there is no user interaction.

      We use Office 365 Exchange Online permissions with full_access_as_app and https://outlook.office365.com/.default scope to generate the token. We use X-AnchorMailbox header and impersonate soap header as well.

       

      Do you have any clue how to fix it? 

Share

Resources