Video Screencast Help

How to search mails from custom folders via EV Search API?

Created: 16 Sep 2013 | 3 comments

I'm using EV search api to search emails. However, I can only search the mails from system folders such as "Inbox", "Sent Items", etc. Our customer created custom folders such as inbox/firm, inbox/helpdesk. I cannot search the mails under those custom folders. Any idea?

This is how I get my achives:

            IArchives archivesRead = (IArchives)cmAPI.Archives;
            archivesRead.Computer = "";
            archivesRead.Permissions = EV_STG_API_PERMISSIONS_TYPE.PERMISSIONS_SEARCH;
            archivesRead.ArchiveTypes = (int)EV_STG_API_ARCHIVE_TYPE.ARCHIVE_TYPE_MAILBOX;

This is how I use the search api:

                ISearchQuery2 query = (ISearchQuery2)new SearchQuery();
                IIndexSearch2 search = (IIndexSearch2)new IndexSearch2();

                query.AddTerm("rtea", "", 0);
                //query.AddOp((int)ESearchQueryOperators.ESQand, (int)ESearchOperatorScope.ESQdefault);
                ISearchResults2 results = (ISearchResults2)search.Search(query.Query, 1, 10000, "");

Operating Systems:

Comments 3 CommentsJump to latest comment

Arjun Shelke's picture

Do you have emails archived in those custom folders? And are they indexed properly?

It could be realted to  IIndexSearch2 :: HasFolders

This property indicates whether the currently selected archive contains a folder structure.


//do something

if (search.HasFolders == true)


//do something

Jim Ma's picture

Yes. There're several emails in those custom folders. And when I select one of these emails in Outlook, there's a status bar float on the top of message body says it has been archived. 

I haven't tried HasFolders. Will let you know the result later. Thanks.

Jim Ma's picture


I checked that search.HasFolders is 'true'. I think it only indicates we have system folder structures like "index", "sent items". However, I don't know if the custom folders can be recognized by HasFolders value.

Still, I'm not able to find any emails in the custom folders by using following code:

ISearchResults2 results = (ISearchResults2)search.Search(query.Query, 1, 10000, "");