使用 Exchange Web 服务 (EWS) 查找邮箱代理

Find mailbox delegates with Exchange Web Services (EWS)

我目前正在 iOS 下开发 EWS 客户端应用程序,因此我使用 Exchange Web 服务与 Exchange 2010 服务器通信(普通 XML 而不是托管 API). 我知道如何访问代表的邮箱和日历以及授予或删除代表对邮箱的访问权限,但在访问之前我需要先找到这些邮箱。也就是说,我想找到我当前用户有权访问的所有邮箱(而不是所有有权访问当前邮箱的用户,这是有据可查的)。

This question from 2011 (EWS API Delegate List) 表示没有可能,但没有提供任何参考。我没有在文档中找到任何资源和提示,但 Outlook 很容易识别这些邮箱。可能是内部使用了一些API,我在与服务器的通信中找不到对应的请求。

如何找到这些邮箱?或者仍然没有办法实现这一目标,假设 2011 年的答案是正确的?如果是这样,Outlook 如何做到这一点?

您可以通过多种方式授予对其他用户邮箱的访问权限,一种方法是通过 Outlook Delegates,它主要修改 Folder Ace 以及用户邮箱中的 FreeBusy 对象。另一种方法是管理员使用 Add-MailboxPermission 授予某人对邮箱的完全访问权限,然后允许邮箱的自动映射 http://www.msexchange.org/articles-tutorials/exchange-server-2010/management-administration/mailbox-auto-mapping-exchange-server-2010-part1.html。这意味着 Outlook 会自动将邮箱连接为附加邮箱。

因此,要查找您的用户将自动映射的邮箱,您可以使用自动发现,邮箱将返回到附加邮箱中,例如

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscove
r" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xsi="http://www.w3.org
/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <a:RequestedServerVersion>Exchange2010_SP2</a:RequestedServerVersion>
    <wsa:Action>http://schemas.microsoft.com/exchange/2010/Autodiscover/Autodiscover/GetUserSettings</wsa:Action>
    <wsa:To>https://autodiscover-s.outlook.com/autodiscover/autodiscover.svc</wsa:To>
  </soap:Header>
  <soap:Body>
    <a:GetUserSettingsRequestMessage xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscover">
      <a:Request>
        <a:Users>
          <a:User>
            <a:Mailbox>user@domain.com</a:Mailbox>
          </a:User>
        </a:Users>
        <a:RequestedSettings>
          <a:Setting>AlternateMailboxes</a:Setting>
        </a:RequestedSettings>
      </a:Request>
    </a:GetUserSettingsRequestMessage>
  </soap:Body>
</soap:Envelope>

对于 Outlook 委托,如果某个随机用户将您添加为委托人(并且不向您发送摘要)或者让您知道什么都不会发生并且 Outlook 不会显示或不知道这一点,情况会有所不同。但是,如果您确实知道有人已授权您访问他们的日历,然后您在第一次执行此操作时在 Outlook 中打开该日历,它将添加一个 Wonderbar(导航)快捷方式 https://msdn.microsoft.com/en-us/library/ee202589(v=exchg.80).aspx that Outlook (and OWA) will then use in the future to show this calendar by default. You can make use of these Nav shortcuts in a mailbox by querying them in the CommonViews Folder eg EWS - Access All Shared Calendars 。 (请注意,如果您在 Office365 中使用新的 REST API,您现在可以在 API 中本地执行此操作)