使用办公室365中的电子邮件获取联系人文件夹项目

时间:2015-08-18 12:53:41

标签: soap office365 exchangewebservices outlook-web-app

我使用以下SOAP请求检索office 365邮件地址中的contacts文件夹中的项目

'<?xml version="1.0" encoding="UTF-8"?>'+
    ' <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' +
     ' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
            ' xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"'+
            ' xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">'+
    ' <soap:Header>'+
       ' <t:RequestServerVersion Version="Exchange2013" />' +
    ' </soap:Header>'+
    ' <soap:Body >'+
       ' <m:FindPeople>'+
          ' <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>'+
          ' <m:ParentFolderId>'+
             ' <t:DistinguishedFolderId Id="contacts"/>'+
          ' </m:ParentFolderId>'+
      ' </m:FindPeople>'+
    ' </soap:Body>'+
    ' </soap:Envelope>';

但出现以下错误。

error

我已经使用了日历文件夹的FindItem,GetFolder方法,这些方法正在运行。

无论如何都要使用名称作为搜索值来查找人员电子邮件地址。

1 个答案:

答案 0 :(得分:1)

Mail Apps中的makeEwsRequestAsync仅支持FindPeople不是其中之一的EWS操作的子集。您可以在https://msdn.microsoft.com/en-us/library/office/fp160952.aspx上查看支持的操作的完整列表。

  
    

无论如何都要使用名称作为搜索值来查找人员电子邮件地址。

  

确实只使用对DisplayName有限制的FindItem,例如

<?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://sc
hemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xml
soap.org/soap/envelope/">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013_SP1" />
  </soap:Header>
  <soap:Body>
    <m:FindItem Traversal="Shallow">
      <m:ItemShape>
        <t:BaseShape>AllProperties</t:BaseShape>
      </m:ItemShape>
      <m:IndexedPageItemView MaxEntriesReturned="1000" Offset="0" BasePoint="Beginning" />
      <m:Restriction>
        <t:Contains ContainmentMode="Substring" ContainmentComparison="IgnoreCase">
          <t:FieldURI FieldURI="contacts:DisplayName" />
          <t:Constant Value="Blah blah" />
        </t:Contains>
      </m:Restriction>
      <m:ParentFolderIds>
        <t:DistinguishedFolderId Id="contacts" />
      </m:ParentFolderIds>
    </m:FindItem>
  </soap:Body>
</soap:Envelope>

干杯 格伦

相关问题