2017-03-09 63 views
0

我想使用電話號碼從聯繫人進行查詢。我試過FindItem肥皂,但由於某種原因無法使用它。我試圖像下面:用電話號碼查詢EWS

<?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: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="FullString" ContainmentComparison="IgnoreCase"> 
       <t:FieldURI FieldURI="contacts:PhoneNumbers" /> 
       <t:Constant Value="SOMEPHONENUMBER" /> 
      </t:Contains> 
     </m:Restriction> 
     <m:ParentFolderIds> 
      <t:DistinguishedFolderId Id="contacts" /> 
     </m:ParentFolderIds> 
    </m:FindItem> 
</soap:Body> 

但我發現了一個"Property cannot be used with this type of restriction"錯誤。有任何想法嗎?

回答

1

不能使用的限制,即強類型屬性,您可能需要使用擴展屬性您要搜索例如對於商家電話號碼使用https://msdn.microsoft.com/en-us/microsoft-r/cc839937.aspx

 <m:Restriction> 
     <t:IsEqualTo> 
     <t:ExtendedFieldURI PropertyTag="14856" PropertyType="String" /> 
     <t:FieldURIOrConstant> 
      <t:Constant Value="9999-9999-999" /> 
     </t:FieldURIOrConstant> 
     </t:IsEqualTo> 
    </m:Restriction> 
+0

感謝@Glen每個電話號碼試試這實際上工作! –