EWS Search Filters - Attachments

Good morning,

I'm using EWS to search for a specific attachment in a user mailbox, using the following code:

sharedServiceAccess = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

//....

ItemView view = new ItemView(searchResultLimit, offset); view.PropertySet = new PropertySet( BasePropertySet.IdOnly); SearchFilter.SearchFilterCollection searchFilterCollection = new SearchFilter.SearchFilterCollection(LogicalOperator.Or); searchFilterCollection.Add(new SearchFilter.ContainsSubstring(EmailMessageSchema.Attachments, "message.rpmsg")); searchFilterCollection.Add(new SearchFilter.ContainsSubstring(EmailMessageSchema.Attachments, "smime.p7m")); FindItemsResults<Item> searchResults = searchResults = sharedServiceAccess.FindItems(folder, searchFilterCollection, view);

The problem is that I'm getting diferent results according to the EXC server that I run the code on:

- I have some EXC2010 and some EXC2013 that returns the correct results

- I have several EXC2013 that returns no results

I've tested with all the available ExchangeVersion parameters and on some of the EXC2013 it will never return any results. If I change the search filter to be a string insted of an object (for example: "attachment:message.rpmsg") the results are also not constant: In some of the server it works and in others it wont (not the same as in the first case).

I've read on the Internet about similar problems but wasn't able to find a solution.

I would really appreciate if someone could help me with this,

Thank you!

May 11th, 2015 10:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics