none
In Cashed Exchange mode Search folder is not querying mails. RRS feed

  • Question

  • All,

    We have created a search folder. Then we have created an Extended Property to add a Filter condition. In Online mode of Outlook, it is working fine as expected. We can able to see the newly created Search folder and the queried mails which satisfies the filter condition. But in Cached Exchange Mode we can able to see the folder but not able to see any mails under the search folder.

    Could anyone please let me know why Search folder is not querying mail in Cashed Exchange mode?

    Following is the Piece of code we are using.

        public string CreateSearchFolderAllCM(string strEmailId)
        {
          if (!GetConnectedToExchange(strEmailId))
            return "ERROR: Couldn't Connect";
    
          Exchange.SearchFolder srchFolder = new Exchange.SearchFolder(exchangeService);
    
          Exchange.ExtendedPropertyDefinition extPropCMCode = new Exchange.ExtendedPropertyDefinition(
          Exchange.DefaultExtendedPropertySet.PublicStrings,
          "xxxxxxxx", Microsoft.Exchange.WebServices.Data.MapiPropertyType.String);
    
          Exchange.SearchFilter.SearchFilterCollection srchFilter = new Exchange.SearchFilter.SearchFilterCollection();
          srchFilter.Add(new Exchange.SearchFilter.Exists(extPropCMCode));
          //srchFilter.Add(new Exchange.SearchFilter.IsNotEqualTo(extPropCMCode,string.Empty));
    
          srchFolder.SearchParameters.RootFolderIds.Add(Exchange.WellKnownFolderName.MsgFolderRoot);
          srchFolder.SearchParameters.Traversal = Microsoft.Exchange.WebServices.Data.SearchFolderTraversal.Deep;
          srchFolder.SearchParameters.SearchFilter = srchFilter;
          srchFolder.DisplayName = strSearchFolder;
    
          try
          {
            //Create Search Folder
            srchFolder.Save(Exchange.WellKnownFolderName.SearchFolders);
    
            Logging.Log("Search Folder Created - " + " - " + strEmailId, true);
            return "INFO: Created Successfully";
          }
          catch(System.Exception ex)
          {
            //write the log and move on...
            Logging.Log(ex, MethodInfo.GetCurrentMethod().DeclaringType.Name, " - " + strEmailId + " : " + MethodInfo.GetCurrentMethod().Name);
            return "ERROR: " + ex.Message;
          }
        }
    
    
    Tuesday, April 5, 2011 12:26 PM

All replies

  • Hi,

    I had a similar issue in cached mode. I was creating search folders under Outlook and they weren't available from other session. It took a while to find out the problem was occuring when the cached mode was on.

    When I turned it off, my search folders became disabled under Outlook. One click on them and I was finally able to activate them "globally"(and retrieve them through EWS)

    I'm now always using outlook in online mode.

    Sorry if my answer isn't solving your problem!


    Tuesday, April 5, 2011 1:04 PM
  • Thanks for your replay.

    We want both online mode as well as the Cashed exchange mode.

    As of now it is working fine in Online mode we need to find solution for Cashed Exchange mode.

    FYI, we are using Outlook2010.

    Any solution for this issue is highly appreciated.

    Wednesday, April 6, 2011 9:07 AM