none
How do I search Contacts in Public Folders by Categories filter? RRS feed

  • Question

  • We just deployed Exchange 2010 upgrading from Exchange 2003. With 2003, I was using WebDav to query exchange and return Contact Items from a Public Folder. In my WebDav query I could insert Categories parameters but I do not see a way to do this in Exchange 2010 on a Public Folder. Basically, my client uses custom Categories which are assigned through Outlook such as "Lawyer", "Doctor", "Engineer", etc. Also note, my client is willing to move from Categories to Custom User Defined Fields. So perhaps that is a better option for Searching? BTW, there are 8000 entries in this folder!

    In summary:

    I have:
    1. Exchange 2010
    2. Public Folder with 8000 contacts. These contacts are labeled with Categories

    I want to:
    1. Query the Public folder of Contacts with Categories filter.
    2. Using Exchange Web Services and/or the Managed Api

    Retrieve exchange.id, fullname from (public folder) contacts where "Categories = "Lawyer" or Categories = "Doctor"
    Trying to accomplish query with ews or managed api

    Any help would be much appreciated!!!

    - Matthew


    Tuesday, February 28, 2012 7:41 PM

Answers

  • You should post a sample of the code your tyring to use but if your trying to use an AQS query against a public folder this wouldn't work because Exchange Search doesn't index public folders.

    So you would need to a search filter (but not a contains) eg something like

                ItemView iv = new ItemView(1000);
                SearchFilter sf1 = new SearchFilter.IsEqualTo(ItemSchema.Categories, "Blue Category");
                SearchFilter sf2 = new SearchFilter.IsEqualTo(ItemSchema.Categories, "Green Category");
                SearchFilter sfCol = new SearchFilter.SearchFilterCollection(LogicalOperator.Or) { sf1, sf2 };
                FindItemsResults<Item> fiItems = service.FindItems(folderid, sfCol, iv);
    Cheers
    Glen
    • Marked as answer by Matthew Alcala Wednesday, February 29, 2012 6:47 AM
    Wednesday, February 29, 2012 4:20 AM

All replies

  • You should post a sample of the code your tyring to use but if your trying to use an AQS query against a public folder this wouldn't work because Exchange Search doesn't index public folders.

    So you would need to a search filter (but not a contains) eg something like

                ItemView iv = new ItemView(1000);
                SearchFilter sf1 = new SearchFilter.IsEqualTo(ItemSchema.Categories, "Blue Category");
                SearchFilter sf2 = new SearchFilter.IsEqualTo(ItemSchema.Categories, "Green Category");
                SearchFilter sfCol = new SearchFilter.SearchFilterCollection(LogicalOperator.Or) { sf1, sf2 };
                FindItemsResults<Item> fiItems = service.FindItems(folderid, sfCol, iv);
    Cheers
    Glen
    • Marked as answer by Matthew Alcala Wednesday, February 29, 2012 6:47 AM
    Wednesday, February 29, 2012 4:20 AM
  • Thank you Glen!! This worked perfectly! Kudos to you and for all the help I got reading your other posts!

    -Matthew

    Wednesday, February 29, 2012 6:47 AM