Fail to SyncFolderHierarchy encounter ErrorAccessDenied The user context is missing

Joyce Beck 31 Reputation points
2021-06-03T09:50:19.333+00:00

Recently when I request SyncFolderHierarchy to some users for in-place archive mailbox
it returns error:

ErrorAccessDenied
This EWS API requires being called with a user context. The user context is missing.

Is it possible that some thing is broken on MS server side?
For some users, this API works fine.

full response:

< HTTP/1.1 200 OK
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/10.0
< request-id: 8159ef05-2f55-4513-a19f-c8d2d82fd54c
< X-CalculatedBETarget: HK0PR06MB3795.apcprd06.prod.outlook.com
< X-BackEndHttpStatus: 200
< Set-Cookie: exchangecookie=ca46acb77ecb4a86816eba2faebddbd8; expires=Fri, 03-Jun-2022 09:08:22 GMT; path=/; secure; HttpOnly
< X-RUM-Validated: 1
< x-ms-appId: af08ce07-1df9-4a39-b6e6-092ac934eb21
< x-EwsHandler: SyncFolderHierarchy
< X-AspNet-Version: 4.0.30319
< X-BeSku: WCS5
< X-DiagInfo: HK0PR06MB3795
< X-BEServer: HK0PR06MB3795
< X-Proxy-RoutingCorrectness: 1
< X-Proxy-BackendServerStatus: 200
< X-Powered-By: ASP.NET
< X-FEServer: HK2PR06CA0023
< Date: Thu, 03 Jun 2021 09:08:24 GMT
<
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="4173" MinorBuildNumber="30" Version="V2018_01_08"
            xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    </s:Header>
    <s:Body>
        <m:SyncFolderHierarchyResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
                <m:SyncFolderHierarchyResponseMessage ResponseClass="Error">
                    <m:MessageText>This EWS API requires being called with a user context. The user context is missing.</m:MessageText>
                    <m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
                    <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
                    <m:SyncState/>
                    <m:IncludesLastFolderInRange>true</m:IncludesLastFolderInRange>
                </m:SyncFolderHierarchyResponseMessage>
            </m:ResponseMessages>
        </m:SyncFolderHierarchyResponse>
    </s:Body>
</s:Envelope>
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
511 questions
0 comments No comments
{count} votes