none
Disable indexing option in Outlook 2007 folders

    Question

  • Hi,

    Is there a way to use the WDS SDK to disable indexing option in Outlook 2007 personal folders?
    I'm new to WDS SDK so could you show me sample codes on how to do it?

    Thank you,
    Rajat
    Wednesday, April 22, 2009 5:50 PM

All replies

  • Could you please make it clear if you want to disable the whole Outlook e-mail indexing or just the personal folder. In the latter case, you could still have other pst files indexed.
    If you want to do the former case, group policy is the way to go. ( http://technet.microsoft.com/en-us/library/cc732491.aspx ) The one you are looking for is "Prevent Indexing Microsoft Office Outlook ".
    If you are seeking the latter case, it is not supported directly by SDK though it is doable.
    Wednesday, April 22, 2009 11:30 PM
  • Hi Jeff,

      I'm trying to programatically disable indexing in the personal folder in Outlook.  So, could you show me how to do that.

    Thank you,
    Rajat
    Thursday, April 23, 2009 1:25 PM
  • Then I assume you want  index some PST files but not the personal folder. From Control Panel->Indexing Option->Modify, in the treeview, you could find the MS Office Outlook node, click to expand it, and you could see there are some children nodes mapping to your personal folder and PST files. For common users, he/she could uncheck these items to disable indexing on certain stores.
    To disable the personal folder with code, you need to use Crawl Scope Manager ( http://msdn.microsoft.com/en-us/library/bb266541(VS.85).aspx ) to disable the personal folder url by using ISearchCrawlScopeManager::AddUserScopeRule.
    To get the personal folder url, try http://blogs.msdn.com/stephen_griffin/archive/2006/05/10/594641.aspx .
    Thanks.
    Thursday, April 23, 2009 5:13 PM
  • Hi Rajat,

    If you were able to code using "ISearchGrawlScopeManager::AddUserScopeRule" to disable indexing for Personal Folders (PST). Could you please share with me how you did it?

    Thank you.../Salamat

    Monday, April 12, 2010 8:12 AM
  • Hi Salamat,

    Sorry for replying late. I haven't been to the forum for a while. Anyway I was able to solve the problem by using the AddUserScopeRule method as follows:

                    CSearchManagerClass csm = new CSearchManagerClass();
                    CSearchCatalogManager cscm = csm.GetCatalog("SYSTEMINDEX");
                    CSearchCrawlScopeManager manager = cscm.GetCrawlScopeManager();

                    manager.AddUserScopeRule("mapi://{SID}/{storeDisplayName}(${storeHash})/",0, 1, 0);
                    manager.SaveAll();

     

    So in this code you will need to compute SID, storeDisplayName = store.Name and storeHash can be computed as:

            
     private static string ComputeHash(string storeEID)
        {
          int idx = 0;  // Index in buffer
          uint hash = 0;  // The hash
          int lengthStoreEID = storeEID.Length / 2; // Length of store EID -- divide by 2 because 2 text characters here represents 1 byte
          // --- Pass 1: Main block (multiple of dword, i.e. 4 bytes) ---
          int cdw = lengthStoreEID / sizeof(uint);  // cdw = Count Double Words (i.e. number of double words in the buffer)
          for (int i = 0; i < cdw; i++, idx += 8)
          {
            int dword = int.Parse(storeEID.Substring(idx, 8), System.Globalization.NumberStyles.HexNumber);
            hash = (hash << 5) + hash + (uint)IPAddress.HostToNetworkOrder(dword);
          }
          // --- Pass 2: Remainder of the block ---
          int cb = lengthStoreEID % sizeof(uint);  // cb = Count Bytes (i.e. number of bytes left in the buffer after pass 1)
          for (int j = 0; j < cb; idx++, j++)
          {
            hash = (hash << 5) + hash + byte.Parse(storeEID.Substring(idx, 2), System.Globalization.NumberStyles.HexNumber);
          }
          return hash.ToString("x");
        }
        private static string EncodeEID(string EID)
        {
          StringBuilder result = new StringBuilder(EID.Length);
          for (int i = 0; i < EID.Length; i += 2)
            result.Append((char)(byte.Parse(EID.Substring(i, 2), System.Globalization.NumberStyles.HexNumber) + 0xAC00));
          return result.ToString();
        }
    

     

    I extracted this from http://stackoverflow.com/questions/2640024/programmaticaly-prevent-vista-desktop-search-wds-from-indexing-pst-files-placed

     

    Hope this helps!

    Rajat

    • Proposed as answer by saloma Friday, January 21, 2011 11:15 AM
    Thursday, May 20, 2010 4:31 PM
  • Rajat, Thank you very much....
    Friday, January 21, 2011 11:14 AM