Freigeben über


Wrapped PST and Indexing

One of the things we’ve seen with Outlook 2013 is that Wrapped PSTs that never used to be indexed by Outlook are indexed now. This can be great if you’ve got a store which can deal with being crawled, but what if your store can’t handle it? The PST provider on which the Wrapped PST is based controls if and when it is indexed. Part of the logic it uses is to call in to the Crawl Scope Manager (CSM) interface to determine if the store has been excluded. Namely, it calls IncludedInCrawlScope, passing in a URL which represents the PST. The CSM will then report whether or not the PST is eligible for indexing.

If you don’t want your store indexed, then the trick is to make sure the CSM returns false here. You can do this by calling AddUserScopeRule and passing the appropriate URL. Here’s the format for the URL:

 mapi15://{SID}/StoreDisplayName($HashNumber)/

As you may note, this URL format is very similar to the one described here:

https://msdn.microsoft.com/en-us/library/office/ff960454.aspx

There are a few key differences and caveats:

  • The URI is mapi15 instead of mapi.
  • The SID must be wrapped in curly brackets.
  • The hash is also calculated using the Algorithm to Calculate the Store Hash Number, but the hexadecimal representation should be generated without any leading zeros. So, for instance, if the hash is 0x0abc1234, in the URL you would use ($abc1234), not ($0abc1234).

Here’s an example URL you might generate:

 mapi15://{S-1-5-21-123456789-123456789-1234567890-12345}/MyStoreProvider($abcd1234)/

Another issue to be aware of is when you add your URL to the CSM. The PST provider is very sensitive to the indexing state changing while the PST is open. If the state changes, the PST may end up kicking off an installer to repair Outlook. So you need to add the URL before the PST knows anything about it. The best time to do this is when your provider is first loaded, during the IMSProvider::Logon, before you call Logon in the PST. At this point, you have enough information to construct the URL and call in to the CSM, but the PST provider is not aware yet that this PST is being opened.

[Update - 1/16/13] Having registered your store for exclusion, you may want to check that it is, in fact, excluded. If you look at the Indexing Options, you'll see an interesting listing: Microsoft Outlook is both under "Included Locations" and "Exclude". Don't worry - this doesn't mean all of Outlook isn't being indexed. The shell extension that Outlook has registered for the mapi15 namespace simply returns "Microsoft Outlook" as the user readable name for any URL which has been excluded. Development did look at augmenting the extension to provide a better string, but decided most users would never look at this UI to begin with, so it wasn't worth the risk. If you want to check that your code ran correctly, you can look at the registration in the registry under this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\CrawlScopeManager\Windows\SystemIndex\WorkingSetRules.  

Enjoy!