php-ews从Exchange Server返回了1000多个联系人


php ews return more than 1,000 contacts from Exchange Server

如何从Exchange Server 2010中恢复一个用户的所有联系人?Exchange Server 2010使用https://github.com/jamesiarmes/php-ewsAPI我尝试过分页,但我需要一些示例代码才能使其工作。

我无法为您的库(我使用自己的fork Garethp/php-ews)提供一个建议您检查的示例(PSR-2和PSR-4与实际更新和维护兼容),但它们基本上都有相同的方法:帮助您编写发送到服务器的XML。因此,如果您想要一个示例,您可以查看MSDN页面,并尝试将它们的XML复制为PHP对象。以下是您想要通过发送的内容

<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="Exchange2010" />
  </soap:Header>
  <soap:Body>
    <m:FindItem Traversal="Shallow">
      <m:ItemShape>
        <t:BaseShape>AllProperties</t:BaseShape>
      </m:ItemShape>
      <m:IndexedPageItemView MaxEntriesReturned="3" Offset="5" BasePoint="Beginning" />
      <m:SortOrder>
        <t:FieldOrder Order="Ascending">
          <t:FieldURI FieldURI="contacts:DisplayName" />
        </t:FieldOrder>
      </m:SortOrder>
      <m:ParentFolderIds>
        <t:DistinguishedFolderId Id="contacts" />
      </m:ParentFolderIds>
    </m:FindItem>
  </soap:Body>
</soap:Envelope>

请注意<m:IndexedPageItemView MaxEntriesReturned="3" Offset="5" BasePoint="Beginning" />,这就是您在结果列表

中查找下一页的方式

你试过用不同的字母作为首字母吗?我想到了这样的东西:

$request->ContactsView->InitialName = 'A';
$request->ContactsView->FinalName = 'B';

如果你有1000多个以字母A开头的联系人,这可能不起作用。