Thursday, August 16, 2012 4:55 PM
I want to add some attributes to standalone MSG Files using VBA, I need to see them in File -> Properties -> Custom. I try to made it by code in http://support.microsoft.com/kb/907985 but it doesn't work. My code is:
Dim myObject As MailItem
Dim olNS As Outlook.NameSpace
Set olNS = Application.Session
Set myObject = olNS.OpenSharedItem(myPath)'myPath - String with address to the file
Dim myUserProperty As Outlook.UserProperty
Set myUserProperty = myObject.UserProperties.Add("Test", olText)
myUserProperty.Value = "TestValue"
Set myObject = Nothing
Set olNS = Nothing
In some of forum's topic I found information about using API and iStorage, but I am still not sure how can I use it to resolve my problem.
If somebody can help, please answer to me. Thank you!
- Moved by Forrest GuoMicrosoft Employee, Moderator Saturday, August 18, 2012 1:36 AM not app for Office question (From:Developing Apps for Office)
Saturday, August 18, 2012 3:02 AM
I don't think there is any way for VBA to directly access standalone MSG files using IStorage and/or OpenMsgOnIStg.
If Redemption is an option, you can use RDOSession.GetMessageFromMsgFile, then set the properties using RDOMail.UserProperties or RDOMail.Fields, followed by RDOMail.Save.
Dmitry Streblechenko (MVP) http://www.dimastr.com/redemption
Redemption - what the Outlook
Object Model should have been
Version 5.3 is now available!