One of the cool new things you can do with the Outlook 2007 Object Model is create and access StorageItem objects. These are hidden messages in .pst or Exchange Mailbox folders that can be a very handy mechanism for storing application settings. The Folder.GetStorage method is used to return (or create if it doesn’t exist) a StorageItem object based on the passed parameters (an Entry ID, message class, or subject). However, if you run the code below (which is from the offline Outlook Developer Reference) with anything but a Mail/Post Item folder currently selected in Outlook, the behavior is not what you’d expect: Sub AssignStorageData() Dim oInbox As Outlook.Folder Set oInbox = Application.ActiveExplorer.CurrentFolder If myStorage.Size = 0 Then ‘ Assign a value to the custom property Now switch to your Inbox. Yup, the “hidden” StorageItem message is not only not created in the non-Mail/Post folder, it is VISIBLE in a completely different folder! It will work as expected if the GetStorage method is called from a Folder object obtained from anything but a Task, Contact, Calendar, Notes or Journal folder – meaning the StorageItem message will be hidden and stored in the specified folder (NOT your Inbox or a completely different folder!). So I guess we have to wait until Service Pack 1… |
You must log in to post a comment.