locked
Ews api - SearchFilter - Exchange Server RRS feed

  • Question

  •  I been using SearchFilter in ews to filter certain required mails. But  EmailMessageSchema::IsResend  filter is not working. Its is a boolean type, and i filterd with (true/false) but still its not working. 

    And also, body filter is working in some exchange(13) but in another org with server(16) it is not working. Is there any specific reasons.

    Thanks,

    SBK

    Sunday, September 27, 2020 4:10 PM

All replies

  •  >>I been using SearchFilter in ews to filter certain required mails. But  EmailMessageSchema::IsResend  filter is not working. Its is a boolean type, and i filterd with (true/false) but still its not working. 

    That property is calculated based on the PidTagMessageFlags property https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagmessageflags-canonical-property so its not usable in a SearchFilter (the error should tell you this). If you want to use that property in a SearchFitler try the ExtendedProperty eg

    ExtendedPropertyDefinition MessageFlags = new ExtendedPropertyDefinition(0x0E07, MapiPropertyType.Integer);
    SearchFilter ise = new SearchFilter.IsEqualTo(MessageFlags, 128);
    


    >> And also, body filter is working in some exchange(13) but in another org with server(16) it is not working. Is there any specific reasons.

    I would suggest you always use AQS for body searchs https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-an-aqs-search-by-using-ews-in-exchange as while SearchFilter should work they have build a temporary restriction which the Store back-fills so if the folder has a large number of email the peformance of this type of filter will be quite poor.

    Monday, September 28, 2020 1:54 AM
  • Thanks for your valuable information,

               Regarding email search, I need to perform  certain  complex operations so, in AQS there are many restrictions to do it and I am not able to achieve it (eg: subject equals test and isread notequals true). (1 and 2 or 3...)

     Is there any issues for body search in SearchFilter. As I stated above body filter is working in some exchange(13) but in another org with server(16) it is not working.

    Thanks,

    SBK

    Wednesday, September 30, 2020 6:44 PM
  • >>(eg: subject equals test and isread notequals true). (1 and 2 or 3...)

    You can do that in AQS if you use grouping

    No there are no issues that should stop it from working but if it is overly complex then that type of query will always suffer performance issues and the issue your seeing is just that it can't perform it. Can you do the same query in Outlook of the Body ? have you tried on a folder with just one item ?

    cheers
    Glen 

    Thursday, October 1, 2020 12:38 AM
  • Thanks for the information,

      Regarding AQS search, only certain keywords are supported(few attributes only supported), 

    Limited control for string searches. Query string searches always ignore case, and are always substring searches. If you want to do case-sensitive, prefix, or exact match searches, use a search filter.

    https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-perform-an-aqs-search-by-using-ews-in-exchange

    I tried to search on all folder with specified body keyword it returns no data,though subject keyword  search is working fine on the same org

    Thanks,

    SBK

    Monday, October 5, 2020 8:55 AM
  • does the search work in Outlook or OWA if not then it probably a server issue (eg content indexes or Exchange search service not working correctly).

    Cheers
    Glen

    Tuesday, October 6, 2020 12:33 AM
  • Yes, there is a issue in owa itself. Is there any troubleshooting steps to rectify it.

    Is there any way to regex search body using search filter? 

    Thanks,

    SBK

    Thursday, October 8, 2020 8:57 AM
  • I would start with https://support.microsoft.com/en-au/help/4013606/search-fails-on-exchange-server-2016-and-exchange-server-2013 could be they are lagging updates. If not you may need to rebuild the index https://practical365.com/exchange-server/exchange-2016-failed-content-index/


    Thursday, October 8, 2020 10:53 PM