UserProperties of MailItem object.

S

Sandeep K

I am adding one user property to an email in outlook 2007 using VSTO Addin.
When I close Outlook application It asks me, "Do you want to save changes?".

Can I avoid this prompt?

API I used :
prop = MailItem.UserProperties.Add("TestProp"
,
Outlook.OlUserPropertyType.olText
, false
,
Outlook.OlFormatText.olFormatTextText);
prop.Value = "Test";
 
T

Tobias Böhm

Just a side note. I'm relatively new to Outlook programming but I got
into quite some trouble because of accessing the UserProperties
directly.
I would write:

UserProperties props = MailItem.UserProperties;
try
{
//Use props...
//...
MailItem.Save();
}
finally
{
Marshall.ReleaseCOMObject(props);
Marshall.ReleaseCOMObject(MailItem);
}
 
K

Ken Slovak - [MVP - Outlook]

What problems did you have with your code?




Just a side note. I'm relatively new to Outlook programming but I got
into quite some trouble because of accessing the UserProperties
directly.
I would write:

UserProperties props = MailItem.UserProperties;
try
{
//Use props...
//...
MailItem.Save();
}
finally
{
Marshall.ReleaseCOMObject(props);
Marshall.ReleaseCOMObject(MailItem);
}
 

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