Outlook AdvancedSearch with Categories throwing parameter exception RRS feed

  • Question

  • I'm getting an ArgumentException when I call AdvancedSearch (Could not complete the operation.  One or more parameter values are not valid.).  Here is the code:

            Search CreateSearchFolder(Store searchStore, MAPIFolder searchFolder, string category)
                string scope = searchFolder.FolderPath;
                string criteria = "\"urn:schemas-microsoft-com:office:office#Keywords\" = '" + category + "'";
                searchStore.Application.AdvancedSearchComplete += new ApplicationEvents_11_AdvancedSearchCompleteEventHandler(Application_AdvancedSearchComplete);
                searchStore.Application.AdvancedSearchStopped += new ApplicationEvents_11_AdvancedSearchStoppedEventHandler(Application_AdvancedSearchStopped);
                return searchStore.Application.AdvancedSearch(scope, criteria, true, category);

    The value of scope is: "\\\\Archive-2012\\Inbox\\Analytics"

    and the value of criteria is: "\"urn:schemas-microsoft-com:office:office#Keywords\" = '.A'"

    Any help appriciated.

    Tuesday, March 6, 2012 12:34 AM