P
PuppetMaster
I am creating a VB COM addin for Outlook 2002 and have come up against
the following problem. Sometimes when I create a custom UserProperty
for a mailItem, when I then do a SaveAs() on this item, the
UserProperty disappears.
It seems that the first time I run the code below, it works fine, but
if I run it a second time, it fails! Also, if make a selection of
emails and loop round this code for each one of them, some of the mails
will have the UserProperty in the SaveAs() item, and some won't?!
Can anyone else replicate this problem, or know why this may be
happening?
--------------------------------------
Dim userprop As UserProperty
Set userprop = m4addin.itemObj.UserProperties.Add("archiveTo", olText,
True)
userprop.Value = "C:\temp"
m4addin.itemObj.Save
MsgBox m4addin.itemObj.UserProperties("archiveTo").Value '=OK
Call m4addin.itemObj.SaveAs(myConfig.HDDq & projectFilename & ".msg")
'At this point the customer property may have disappeared!
Dim foo As MailItem
Set foo = m4addin.oApp.CreateItemFromTemplate(myConfig.HDDq &
projectFilename & ".msg")
MsgBox foo.UserProperties.Count
Set foo = Nothing
the following problem. Sometimes when I create a custom UserProperty
for a mailItem, when I then do a SaveAs() on this item, the
UserProperty disappears.
It seems that the first time I run the code below, it works fine, but
if I run it a second time, it fails! Also, if make a selection of
emails and loop round this code for each one of them, some of the mails
will have the UserProperty in the SaveAs() item, and some won't?!
Can anyone else replicate this problem, or know why this may be
happening?
--------------------------------------
Dim userprop As UserProperty
Set userprop = m4addin.itemObj.UserProperties.Add("archiveTo", olText,
True)
userprop.Value = "C:\temp"
m4addin.itemObj.Save
MsgBox m4addin.itemObj.UserProperties("archiveTo").Value '=OK
Call m4addin.itemObj.SaveAs(myConfig.HDDq & projectFilename & ".msg")
'At this point the customer property may have disappeared!
Dim foo As MailItem
Set foo = m4addin.oApp.CreateItemFromTemplate(myConfig.HDDq &
projectFilename & ".msg")
MsgBox foo.UserProperties.Count
Set foo = Nothing