Searchfolder created from EWS is not displaying items falling under criteria within Outlook


I have been working on different SearchFolders cases lately where customers were trying to create SearchFolder using EWS. Working on those issues has uncovered a limitation of Outlook (I tested it on 2007, but may exist with earlier versions as well)

I created the search folder using the following XML

<?xml version="1.0"?>
<CreateFolderType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ParentFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
    <DistinguishedFolderId Id="searchfolders" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />
  </ParentFolderId>
  <Folders xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
    <SearchFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
      <DisplayName>Employee Search</DisplayName>
      <SearchParameters Traversal="Deep">
        <Restriction>
          <And>
            <IsNotEqualTo>
              <ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="EmployeeID" PropertyType="String" />
              <FieldURIOrConstant>
                <Constant Value="" />
              </FieldURIOrConstant>
            </IsNotEqualTo>
            <Exists>
              <ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="CustomPropertyName" PropertyType="String" />
            </Exists>
          </And>
        </Restriction>
        <BaseFolderIds>
          <DistinguishedFolderId Id="inbox" />
        </BaseFolderIds>
      </SearchParameters>
    </SearchFolder>
  </Folders>                                                                  
</CreateFolderType>

I have created an email with custom property and it has some value in there to meet the criteria. The search folder is created and visible in the Outlook but I still do not see any entries under that folder. I also tried with just "Exists" criteria for the custom property but still it does not list the item. Then I created another SearchFolder with specific words in subject and itemClass = IPM.NOTE and that works fine… surprised!!

I went ahead and tried to test the Search Folder from OWA, to further add to my surprise it was not even listed in OWA… strange!! So then I dig into support.microsoft.com and found the following KB - http://support.microsoft.com/kb/831400

Symptoms: When you create Search Folders in Microsoft Office Outlook 2007 and Microsoft Office Outlook 2003in a Microsoft Exchange profile, the Search Folders do not appear in Microsoft Outlook Web Access.

Cause: This behavior occurs when you use Outlook in Cached Exchange Mode. The local copy of your mailbox maintains a Finder folder. This folder is not synchronized with the Finder folder that is in your Microsoft Exchange mailbox.

Resolution: Switch to online mode, expand search folders, let it sync with server and then you should be able to see.

I followed the resolution steps and now I can see the items in OWA & also in Outlook… relief!!

Happy Debugging…

Skip to main content