What To Do? What To Do?

Melissa put up a blog entry on making a PST show up on the To-Do Bar in Outlook 2007. This naturally raised the question of how you could do this programmatically. It turns out that the To-Do Bar itself selects which stores to list. It does this by looking in each store in the profile for specially constructed search folders. So getting a PST (or any other store) listed in the To-Do Bar is really a matter of getting these search folders created. Unfortunately, this is where things get really complicated really fast.

But there are workarounds, and development has asked me to document them. The simplest workaround is to make the PST the default store in the profile. Outlook will create the special search folders needed for the To-Do Bar in the default store. After launching Outlook with the PST as the default (you should be able to use the OOM to do this), you can restore the original default store. This should work with any store capable of being a default store in a profile.

Now - that's a bit of a hack, but it'll work. If you're using the Account Management API already to manage identities for your store, there's another way to get the folders created. Outlook 2007 introduces a new property, PROP_ACCT_DELIVERY_STORE, which is primarily used to control which store is the delivery store for an identity, such as a POP account. But its use is not limited to POP. If your store is listed in PROP_ACCT_DELIVERY_STORE for an account, Outlook will create the search folders, and your store will appear in the To-Do Bar.

Here's the details on the prop (I wanted to mimic the MSDN here but my HTML skillz are too weak to handle that, so this is what you get.)