question

KasinaatSelviSukesh-3157 avatar image
0 Votes"
KasinaatSelviSukesh-3157 asked GlenScales-6756 commented

SyncFolderHierarchy fails for archivemsgfolderroot

We have a client application running in our environment which uses the SyncFolderHierarchy method to get the folder contents from mailboxes. For some time now we are facing error with getting folder details of certain archive mailboxes in our environment. The client application running in our environment uses EWS proxy code to contact the EWS endpoint with basic authentication.

EWSRequest:

  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Header> <ExchangeImpersonation xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> <ConnectingSID> <PrimarySmtpAddress>*****@*****.onmicrosoft.com</PrimarySmtpAddress> </ConnectingSID> </ExchangeImpersonation> <RequestServerVersion Version="Exchange2016" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" /> </soap:Header> <soap:Body> <SyncFolderHierarchy xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"> <FolderShape> <BaseShape xmlns="http://schemas.microsoft.com/exchange/services/2006/types">AllProperties</BaseShape> </FolderShape> <SyncFolderId> <DistinguishedFolderId Id="archivemsgfolderroot" xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> <Mailbox><EmailAddress>*****@*****.onmicrosoft.com</EmailAddress></Mailbox> </DistinguishedFolderId> </SyncFolderId> </SyncFolderHierarchy> </soap:Body> </soap:Envelope> 



EWSResponse:

  <?xml version="1.0" encoding="utf-8"?> <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:ErrorNoRespondingCASInDestinationSite</faultcode> <faultstring xml:lang="en-US">Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request.</faultstring> <detail> <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorNoRespondingCASInDestinationSite</e:ResponseCode> <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request.</e:Message> </detail> </s:Fault> </s:Body> </s:Envelope> These are the SOAP Responses I am getting. Please provide your insights in this issue. Thanks in advance. 


office-addins-devmicrosoft-365-apps-publishing-devoffice-exchange-server-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GlenScales-6756 avatar image
0 Votes"
GlenScales-6756 answered KasinaatSelviSukesh-3157 edited

That problem is generally caused because you not setting the X-AnchorMailbox header to the mailbox you are impersonating, if your using WSDL proxy code you need to do something like the following to override the GetWebRequest method of the ExchangeServerBinding Class eg

     class CustomExchangeServiceBinding: ExchangeServiceBinding
     {
         public String AnchorMailbox { get; set; }
         protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request)
         {
    
             if (!String.IsNullOrEmpty(AnchorMailbox))
             {
                 request.Headers.Add("X-AnchorMailbox", AnchorMailbox);
             }
             System.Net.HttpWebResponse
             response = (System.Net.HttpWebResponse)base.GetWebResponse(request);
             return response;
         }
     }

Then use your custom class instead of ExchangeServiceBinding

 CustomExchangeServiceBinding esb = new CustomExchangeServiceBinding();

You can also modify the referances.cs file directly but if you ever refresh you proxies the changes would be lost



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Glen,
I have "X-AnchorMailbox" set in my code, but still I am unable to perform the operation.
FYI, all the Usermailbox operations are success, only archive mailboxes are failing.

0 Votes 0 ·
GlenScales-6756 avatar image GlenScales-6756 KasinaatSelviSukesh-3157 ·

If its Onprem then the next place to look would be in the EWS log on the CAS server that is processing the request it may give a little more information. Is there anything different about the locations of the archives to don't work vs the one that do ? or are all Archive failing ?

0 Votes 0 ·

This is happening in an O365 online tenant for some of the archive mailboxes not all.

0 Votes 0 ·
GlenScales-6756 avatar image
0 Votes"
GlenScales-6756 answered GlenScales-6756 commented

One thing I would try is try using the Guid of the archive mailbox (you'll need to use Get-Mailbox -archive to get it) in the AnchorMailbox header and see if that makes a difference https://developer.microsoft.com/en-us/office/blogs/error-improvement-for-invalid-x-anchormailbox-in-rest-api-calls/

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GlenScales-6756 Tried setting the GUID in X-AnchorMailbox, still this issue persists.

Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request.


This error message has got to have some significance, why does this happen all of a sudden. Is this some kind of issue from microsoft end?

Or Am I missing something with any routing headers that need to be set for an EWS Request





0 Votes 0 ·
GlenScales-6756 avatar image GlenScales-6756 KasinaatSelviSukesh-3157 ·

That error means you request is being proxied and the destination isn't responding within a certain timeframe, using the correct routing header means you avoid the proxy and hit the destination server directly (well more directly as there are front-end/back-end involved). Why it just started happening I would raise a support issue with Microsoft provide them with the clientid of the requests that are failing and then they can trace what's happening in the logs.

0 Votes 0 ·