Office 365上的EWS GetFolder错误

Vla*_*lad 5 calendar exchangewebservices office365

我有一个具有以下帐户的Office 365帐户:

  • 一个主要用户:mainuser@company.onmicrosoft.com
  • 另一个用户:someuser@company.onmicrosoft.com

someuser@company.onmicrosoft.com已与mainuser@company.onmicrosoft.com共享他的日历

然后,我执行以下EWS操作(通过mainuser@company.onmicrosoft.com)以获取为someuser@company.onmicrosoft.com设置的日历权限

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">

      <FolderShape>
        <t:BaseShape>Default</t:BaseShape>
        <t:AdditionalProperties>
          <t:FieldURI FieldURI="folder:PermissionSet"/>
        </t:AdditionalProperties>
      </FolderShape>

      <m:FolderIds>
        <t:DistinguishedFolderId Id="calendar">
          <t:Mailbox>
            <t:EmailAddress>someuser@company.onmicrosoft.com</t:EmailAddress>
          </t:Mailbox>
        </t:DistinguishedFolderId>
      </m:FolderIds>

    </GetFolder>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

一切正常,当我收到如下响应时:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo 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" MajorVersion="15" MinorVersion="20" MajorBuildNumber="56" MinorBuildNumber="13" Version="V2017_07_11"/>
  </s:Header>
  <s:Body>
    <m:GetFolderResponse 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:GetFolderResponseMessage ResponseClass="Success">
    <m:ResponseCode>NoError</m:ResponseCode>
    <m:Folders>
      <t:CalendarFolder>
        <t:FolderId Id="some-folder-id"/>
        <t:DisplayName>Calendar</t:DisplayName>
        <t:TotalCount>67</t:TotalCount>
        <t:ChildFolderCount>2</t:ChildFolderCount>
        <t:PermissionSet>
          ...    
        </t:PermissionSet>
      </t:CalendarFolder>
    </m:Folders>
  </m:GetFolderResponseMessage>
</m:ResponseMessages>
    </m:GetFolderResponse>
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

除非someuser@company.onmicrosoft.com外部联系人共享他的日历,否则当我执行相同的请求时,我突然收到此响应错误

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo 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" MajorVersion="15" MinorVersion="20" MajorBuildNumber="56" MinorBuildNumber="13" Version="V2017_07_11"/>
  </s:Header>
  <s:Body>
    <m:GetFolderResponse 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:GetFolderResponseMessage ResponseClass="Error">
    <m:MessageText>Access is denied. Check credentials and try again., Can't look up the requested Entry ID.</m:MessageText>
    <m:ResponseCode>ErrorAccessDenied</m:ResponseCode>
    <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
    <m:Folders/>
  </m:GetFolderResponseMessage>
</m:ResponseMessages>
    </m:GetFolderResponse>
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

我不明白为什么Office 365会返回EWS错误而不是过滤我们不应该访问的数据...我们应该能够获得与内部组织有关的日历权限,而不考虑任何外部日历共享。

是否有关于预定解决方案的相同问题或信息?