Actually, it can also take an .msg file, as well as an .oft file, but it would be worth seeing if an .oft file works better in this scenario.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
"Dave Kane [MVP - Outlook]" wrote in message ...
CreateItemFromTemplate takes an OFT file as its argument. Try
Call m4addin.itemObj.SaveAs(myConfig.HDDq & projectFilename &
".oft",olTemplate)
and
Set foo = m4addin.oApp.CreateItemFromTemplate(myConfig.HDDq &
projectFilename & ".oft")
"PuppetMaster" wrote in message
oups.com...
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