使用 EWS 作为委托访问收件箱时出现错误消息

Error message when accessing inbox as delegate by using EWS

我目前正在尝试访问一个邮箱,该邮箱已按照 documentation 中的描述作为代理人与我共享。根据请求(来自文档),

<?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
                   xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
                   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Header>
        <t:RequestServerVersion Version=" Exchange2007_SP1" />
      </soap:Header>
      <soap:Body>
        <m:CreateItem MessageDisposition="SaveOnly">
          <m:SavedItemFolderId>
            <t:DistinguishedFolderId Id="drafts">
              <t:Mailbox>
                <t:EmailAddress>email of my inbox</t:EmailAddress>
              </t:Mailbox>
            </t:DistinguishedFolderId>
          </m:SavedItemFolderId>
          <m:Items>
            <t:Message>
              <t:Subject>Company Soccer Team</t:Subject>
              <t:Body BodyType="HTML">Are you interested in joining?</t:Body>
              <t:ToRecipients>
                <t:Mailbox>
                  <t:EmailAddress>inbox I want to access</t:EmailAddress>
                </t:Mailbox>
              </t:ToRecipients>
            </t:Message>
          </m:Items>
        </m:CreateItem>
      </soap:Body>
    </soap:Envelope>

我总是收到回复

    <?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="2430" MinorBuildNumber="27" Version="V2018_01_08" />
   </s:Header>
   <s:Body>
      <m:FindFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="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">
         <m:ResponseMessages>
            <m:FindFolderResponseMessage ResponseClass="Error">
               <m:MessageText>Mailbox does not exist.</m:MessageText>
               <m:ResponseCode>ErrorNonExistentMailbox</m:ResponseCode>
               <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
            </m:FindFolderResponseMessage>
         </m:ResponseMessages>
      </m:FindFolderResponse>
   </s:Body>
</s:Envelope>

有人知道为什么回复说邮箱不存在吗?在 Outlook 中,我可以毫无问题地访问此邮箱。

您在

中指定的邮箱

           <m:SavedItemFolderId>
            <t:DistinguishedFolderId Id="drafts">
              <t:Mailbox>
                <t:EmailAddress>email of my inbox</t:EmailAddress>
              </t:Mailbox>
            </t:DistinguishedFolderId>

是尝试将消息保存到的位置,因此该错误仅表示您在此处使用的任何值均无效。您在

中使用的值

              <t:ToRecipients>
                <t:Mailbox>
                  <t:EmailAddress>inbox I want to access</t:EmailAddress>
                </t:Mailbox>
              </t:ToRecipients>

将成为您创建的消息草稿的“收件人”字段

由于其中一个邮箱托管在 Exchange Online 上而另一个在内部部署,因此引发了错误消息。