Outlook 2007: Sample code for using StorageItem?

Joined
Jul 19, 2011
Messages
6
Reaction score
0
Hi,

I want to store some user preferences - a short list of other Exchange users and maybe a few boolean variables - in each user's hidden storage data in their Inbox.

Is there any sample code out there which might help me do this please? I'm a bit out of my depth... :blush:
 
Joined
Jul 19, 2011
Messages
6
Reaction score
0
OK, there is code out there, and help:

http://www.add-in-express.com/creat...ok-object-model-propertyaccessor-storageitem/

and

https://www.pcreview.co.uk/forums/outlook-2007-read-write-out-office-settings-t3802430.html

but I'm having a few fundamental issues understanding how to save the data in the right format.

Can anyone help at all?

Pretty please?

Sub StoreData()
Dim oInbox As Folder
Dim myStorage As StorageItem
Dim myPrivateProperty As UserProperty
Dim lngOrderNumber As Long

Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox)
' Get an existing instance of StorageItem by subject, or create new if it doesn't exist
Set myStorage = oInbox.GetStorage("My Private Storage", olIdentifyBySubject)

If myStorage.Size = 0 Then
'There was no existing StorageItem by this subject, so created a new one
'Create a custom property for Order Number
Set myPrivateProperty = myStorage.UserProperties.Add("Order Number", olNumber)
Else
'Assume that existing storage has the Order Number property already
Set myPrivateProperty = myStorage.UserProperties("Order Number")
End If
myPrivateProperty.Value = lngOrderNumber
myStorage.Save
End Sub

But how do I store a table in there?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top