Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Exchange EWS how to search across multiple folders.

$
0
0

Hi,

I am using Exchange EWS to search mailbox for messages that match a certain search criteria. The examples are helpful, but I was looking for an example that allows you to search multiple folders using a single call. Is this possible?

http://msdn.microsoft.com/en-us/library/exchange/hh148195(v=exchg.140).aspx

contains

ItemView iv = new ItemView(1000);
SearchFilter sfSearchFilter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Subject, "rugby");
FindItemsResults<Item> fiitems = service.FindItems(WellKnownFolderName.Inbox, sfSearchFilter, iv);

Note the above example only searches Inbox.

Since some users move items from Inbox to other folders, how can we be sure that those folders can be searches as well?

I am also aware of service.findFolders() to enumerate all folders. In some cases, this enumeration gives a large number of folders (some that do not have any new messages). However, I would like to limit the search to only the folders that have messages in the last six months.

Thanks.


Viewing all articles
Browse latest Browse all 7132

Trending Articles