【问题标题】:php ews return more than 1,000 contacts from Exchange Serverphp ews 从 Exchange Server 返回超过 1,000 个联系人
【发布时间】:2015-06-25 02:32:50
【问题描述】:

如何从使用https://github.com/jamesiarmes/php-ews API 限制对 1000 的响应的 Exchange Server 2010 中恢复一位用户的所有联系人?我尝试了分页,但我需要一些示例代码才能让它工作。

【问题讨论】:

    标签: php outlook exchangewebservices exchange-server-2010


    【解决方案1】:

    我无法为您的库提供示例(我使用自己的 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>
    

    注意&lt;m:IndexedPageItemView MaxEntriesReturned="3" Offset="5" BasePoint="Beginning" /&gt;,这是您在结果列表中查找下一页的方式

    【讨论】:

      【解决方案2】:

      您是否尝试过使用不同的字母作为首字母?我想到了这样的事情:

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

      如果您有超过 1,000 个以字母 A 开头的联系人,这可能不起作用。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-04-08
        • 1970-01-01
        • 1970-01-01
        • 2011-08-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多