Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   UserProperties of MailItem object. (http://www.outlookbanter.com/add-ins-outlook/93832-userproperties-mailitem-object.html)

Sandeep K August 17th 09 03:47 PM

UserProperties of MailItem object.
 
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";


Ken Slovak - [MVP - Outlook] August 17th 09 07:26 PM

UserProperties of MailItem object.
 
Sure, save the item using code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Sandeep K" Sandeep wrote in message
...
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";



Tobias Böhm August 19th 09 11:03 AM

UserProperties of MailItem object.
 
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);
}

On 17 Aug., 16:47, Sandeep K Sandeep
wrote:
I am adding one user property to an email in outlook 2007 using VSTO Addin.


Ken Slovak - [MVP - Outlook] August 19th 09 02:36 PM

UserProperties of MailItem object.
 
What problems did you have with your code?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Tobias Böhm" wrote in message
...
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);
}



All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com