What To Do? What To Do?
[This is now documented here: https://msdn2.microsoft.com/en-us/library/bb905124.aspx]
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.)
PROP_ACCT_DELIVERY_STORE
Returns the Entry ID of the default delivery store for the account.
Quick Info
See IOlkAccount.
Identifier: | 0x0018 |
Property type: | PT_BINARY |
Property tag: | 0x00180102 |
Access: | Read-write |
Remarks
Get or set this property with IOlkAccount::GetProp and IOlkAccount::SetProp.
7/13/07, 11:39AM Update - development agreed we can document the two props Dmitry pointed out. Yay!
PROP_ACCT_DELIVERY_FOLDER
Returns the Entry ID of the default delivery folder for the account. Default is Inbox.
Quick Info
See IOlkAccount.
Identifier: | 0x0019 |
Property type: | PT_BINARY |
Property tag: | 0x00190102 |
Access: | Read-write |
Remarks
Get or set this property with IOlkAccount::GetProp and IOlkAccount::SetProp.
PROP_ACCT_SENTITEMS_EID
Returns the Entry ID of the default sent items folder for the account. Default is Sent Items.
Quick Info
See IOlkAccount.
Identifier: | 0x0020 |
Property type: | PT_BINARY |
Property tag: | 0x00200102 |
Access: | Read-write |
Remarks
This property is only available on POP3 and IMAP accounts. It cannot be set.
Get this property with IOlkAccount::GetProp.
Comments
Anonymous
July 12, 2007
For the sake of completeness: 0x0019 will give you the entry id of the folder where the incoming messages are supposed to be delivered (Inbox by default). 0x0020 is the entry id for the sent items (Sent Items folder by default). All of these properties are Outlook 2007 specificAnonymous
August 04, 2007
Setting PROP_ACCT_SENTITEMS_EID property (no matter what it is set to, even the same old value), always raises E_ACCT_NOT_FOUND error. PROP_ACCT_SENTITEMS_EID is always set automatically whenever PROP_ACCT_DELIVERY_STORE or PROP_ACCT_DELIVERY_FOLDER are set. Are we not supposed to be setting PROP_ACCT_SENTITEMS_EID at all?Anonymous
August 07, 2007
Dmitry - you're right. I overlooked that in the code. PROP_ACCT_SENTITEMS_EID is hardcoded for the POP3 and IMAP account types and can't be set for other account types.