You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

EWS调用FindItem查询联系人文件夹返回ErrorNonExistentMailbox问题求助

EWS调用FindItem查询联系人文件夹返回ErrorNonExistentMailbox,但FindFolder正常

我们的应用通过EWS备份Exchange(含Office 365)邮箱,采用OAuth2认证,使用Exchange管理员权限账号,通过Exchange Online Management模块cmdlets获取邮箱列表及对应全权限。应用运行多年正常,但近期调用FindItem查询联系人文件夹时返回ErrorNonExistentMailbox错误,调用FindFolder查询同一文件夹则成功,其他文件夹(如日历、任务等)无异常。

相关请求与响应日志如下:

<Trace Tag="EwsRequest" Tid="4" Time="2023-08-28 12:40:51Z" Version="0.0.0.0">
  <?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="Exchange2016" />
    </soap:Header>
    <soap:Body>
      <m:FindFolder Traversal="Shallow">
        <m:FolderShape>
          <t:BaseShape>IdOnly</t:BaseShape>
          <t:AdditionalProperties>
            <t:FieldURI FieldURI="folder:DisplayName" />
            <t:FieldURI FieldURI="folder:ChildFolderCount" />
            <t:FieldURI FieldURI="folder:TotalCount" />
            <t:FieldURI FieldURI="folder:FolderClass" />
          </t:AdditionalProperties>
        </m:FolderShape>
        <m:IndexedPageFolderView MaxEntriesReturned="300" Offset="0" BasePoint="Beginning" />
        <m:ParentFolderIds>
          <t:DistinguishedFolderId Id="contacts">
            <t:Mailbox>
              <t:EmailAddress>alex@ra*.com</t:EmailAddress>
            </t:Mailbox>
          </t:DistinguishedFolderId>
        </m:ParentFolderIds>
      </m:FindFolder>
    </soap:Body>
  </soap:Envelope>
</Trace>
<Trace Tag="EwsResponse" Tid="4" Time="2023-08-28 12:40:53Z" Version="0.0.0.0">
  <?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="6699" MinorBuildNumber="34" 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:FindFolderResponse 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:FindFolderResponseMessage ResponseClass="Success">
            <m:ResponseCode>NoError</m:ResponseCode>
            <m:RootFolder IndexedPagingOffset="8" TotalItemsInView="8" IncludesLastItemInRange="true">
              <t:Folders>
                <t:ContactsFolder>
                  <t:FolderId Id="AAMkADdhNGNjMjZjLTc1NTEtNDA5ZS05NWE4LWQ..." ChangeKey="AwAAABYAAAB6owpFxfBvQLC3vHbnrlnCAAD0fR4P" />
                  <t:FolderClass>IPF.Contact.OrganizationalContacts</t:FolderClass>
                  <t:DisplayName>Organizational Contacts1</t:DisplayName>
                  <t:TotalCount>0</t:TotalCount>
                  <t:ChildFolderCount>0</t:ChildFolderCount>
                </t:ContactsFolder>
              </t:Folders>
            </m:RootFolder>
          </m:FindFolderResponseMessage>
        </m:ResponseMessages>
      </m:FindFolderResponse>
    </s:Body>
  </s:Envelope>
</Trace>
<Trace Tag="EwsRequest" Tid="4" Time="2023-08-28 12:40:54Z" Version="0.0.0.0">
  <?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="Exchange2016" />
    </soap:Header>
    <soap:Body>
      <m:FindItem Traversal="Shallow">
        <m:ItemShape>
          <t:BaseShape>IdOnly</t:BaseShape>
          <t:AdditionalProperties>
            <t:FieldURI FieldURI="item:ItemClass" />
            <t:ExtendedFieldURI PropertySetId="aaee6810-ec59-48f0-824d-bccaa610bbdb" PropertyId="1" PropertyType="String" />
            <t:FieldURI FieldURI="item:LastModifiedTime" />
            <t:FieldURI FieldURI="item:Size" />
            <t:ExtendedFieldURI PropertyTag="12299" PropertyType="Binary" />
            <t:ExtendedFieldURI PropertyTag="26082" PropertyType="Binary" />
          </t:AdditionalProperties>
        </m:ItemShape>
        <m:IndexedPageItemView MaxEntriesReturned="1000" Offset="0" BasePoint="Beginning" />
        <m:ParentFolderIds>
          <t:DistinguishedFolderId Id="contacts">
            <t:Mailbox>
              <t:EmailAddress>alex@ra*.com</t:EmailAddress>
            </t:Mailbox>
          </t:DistinguishedFolderId>
        </m:ParentFolderIds>
      </m:FindItem>
    </soap:Body>
  </soap:Envelope>
</Trace>
<Trace Tag="EwsResponse" Tid="4" Time="2023-08-28 12:40:55Z" Version="0.0.0.0">
  <?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="6699" MinorBuildNumber="34" 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:FindItemResponse 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:FindItemResponseMessage ResponseClass="Error">
            <m:MessageText>Mailbox does not exist.</m:MessageText>
            <m:ResponseCode>ErrorNonExistentMailbox</m:ResponseCode>
            <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          </m:FindItemResponseMessage>
        </m:ResponseMessages>
      </m:FindItemResponse>
    </s:Body>
  </s:Envelope>
</Trace>

更新说明:若联系人项位于非联系人文件夹(如已删除邮件),调用GetItem操作也会出现相同错误。

内容的提问来源于stack exchange,提问作者Aleksey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 01:47:01