Delete Data to Reset Solution Storage
This topic describes how to delete existing solution data to reset the solution storage:
Use Folder.GetStorage to obtain an existing StorageItem object in a specific folder. This call will return a new StorageItem object if none already exists.
Use StorageItem.Delete to remove the object permanently from the folder.
Use Folder.GetStorage to create a new instance of the StorageItem object with the same subject.
Use the Add method of StorageItem.UserProperties to create a custom property Order Number.
Set the Order Number property.
Use StorageItem.Save to save the StorageItem object to the folder.
Sub StoreData()
Dim oInbox As Folder
Dim myStorage As StorageItem
Dim myPrivateProperty As UserProperty
Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox)
' Get an existing instance of StorageItem by subject
Set myStorage = oInbox.GetStorage("My Private Storage", olIdentifyBySubject)
'Remove the storage permanently assuming it's old
myStorage.Delete
Set myStorage = Nothing
'Get a new instance of StorageItem in the Inbox
Set myStorage = oInbox.GetStorage("My Private Storage", olIdentifyBySubject)
'Create custom property for Order Number
Set myPrivateProperty = myStorage.UserProperties.Add("Order Number", olNumber)
'Store application data in the Order Number property
myPrivateProperty.Value = 1000
'Save the data to the Inbox
myStorage.Save
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.