[EWS][Java] How can I use the Search Filter only mails with attachments? RRS feed

  • Question

  • Hey,

    I'm trying to search a folder ( doesn't matter  which ) for ONLY mails with attachments.
    How can I use the search filter for that purpose? 


    Wednesday, February 25, 2015 4:15 PM

All replies

  • Hey!

    Is there any way I can get only the mails with attachments, without scanning all of them?

    Wednesday, February 25, 2015 1:54 PM
  • You can drag the attachment collumn from settings and sort on that collumn

    In the main Outlook window, on the View menu, point to Current View, and then click Customize Current View.

    Click Fields. In the Available fields list, click the field that you want to add, and then click Add.

    Come back and mark replies as answer if they help, and help others with the same problem. If this post is helpful please vote it as Helpful on the left side.

    • Edited by AWH84 Wednesday, February 25, 2015 2:06 PM
    Wednesday, February 25, 2015 2:06 PM
  • I think you didn't understand my question...

    I want to write  a program in Java that allows me to index all the emails with attachments./

    I'm trying to find the most efficient way to do so...

    Wednesday, February 25, 2015 2:17 PM
  • Do you already have some code that you're trying to modify, or are you just asking generally? You can filter for attachments using Exchange Web Services.

    I see your other thread where you indicate you are using EWS. A SearchFilter will work here, you need to filter on the HasAttachments property. Something like (in C#):

    SearchFilter.IsEqualTo hasAttachmentFilter = new SearchFilter.IsEqualTo(
      ItemSchema.HasAttachments, true);

    Wednesday, February 25, 2015 4:46 PM
  • I'm asking generally, as for now I managed to do so by going on each and every folder and extracting the files out of them.

    What i'm looking for is something more simple, like using a search filter on the root folder and get back every mail that has a document ( like a list of items ).
    (I mean if there is an option the the server will give me all the files that has attachments without me going over the folders )
    I will try what you wrote.

    • Edited by ItaiSoudry Thursday, February 26, 2015 4:16 PM
    Thursday, February 26, 2015 4:00 PM