UserProperties of MailItem object.

  • Thread starter Thread starter Sandeep K
  • Start date Start date
Status
Not open for further replies.
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";
 
Sure, save the item using code.

"Sandeep K" <Sandeep K> wrote in message

news:F8E959C4-F420-47AB-8454-D23721E1792C@microsoft.com...
> 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";
>
 
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 K...
wrote:
> 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";
 
What problems did you have with your code?

"Tobias Böhm" <boehm.tobi@googlemail.com> wrote in message

news:3d2c66dd-42c7-41d5-840b-89d05340e80b@b14g2000yqd.googlegroups.com...

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);

}
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Cannot populate certain UserProperties in Outlook from Excel Outlook VBA and Custom Forms 2
W Appointment userproperties disappear Outlook VBA and Custom Forms 4
J Storing userproperties to array Outlook VBA and Custom Forms 4
mrmmickle1 UserProperties VBA to move message to another folder Outlook VBA and Custom Forms 7
N Get the seconds with userproperties.add method VBA Outlook Outlook VBA and Custom Forms 4
R How to search for blank userproperties field Outlook VBA and Custom Forms 4
M Assigning Values to Contact UserProperties Outlook VBA and Custom Forms 1
V Difference between UserProperties and ItemProperties? Outlook VBA and Custom Forms 4
Rob Can't save MailItem because the message changed in .pst file Outlook VBA and Custom Forms 0
P MailItem.To Property with VBA not work Outlook VBA and Custom Forms 2
G Event when creating task from mailitem Outlook VBA and Custom Forms 2
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
U Outbox Message Stuck after reading some MailItem Properties with VBA Outlook VBA and Custom Forms 1
oliv- Best practice for catching mailitem.events Outlook VBA and Custom Forms 0
oliv- How to select an mailitem in explorer with "show as conversation" Outlook VBA and Custom Forms 8
JorgeDario How to capture and save the text, when responding a MailItem? Outlook VBA and Custom Forms 3
JorgeDario how to check a MailItem has a digital signature (SMIME) with vba? Outlook VBA and Custom Forms 1
JorgeDario ¿What property of mailitem can be used like primary key? Outlook VBA and Custom Forms 6
S Outlook VBA rule script to process both MailItem and MeetingItem Using Outlook 0
B right click outlook objects in OL2010 acts on current inbox mailitem Using Outlook 6
C MailItem Find method doesn't work Using Outlook 0
C MailItem.SaveAs not working Outlook VBA and Custom Forms 10
G RE:The signature is also inserted if you touch the MailItem. Outlook VBA and Custom Forms 1
B Add signature to MailItem Outlook VBA and Custom Forms 3
C How can I create a new MailItem inside a user folder? Outlook VBA and Custom Forms 4
S Create a new Outlook MailItem in an Outlook folder(not a draft) Outlook VBA and Custom Forms 2
A How to get OOM MailItem Raw data Outlook VBA and Custom Forms 2
S Saved Property of MailItem is copied Outlook VBA and Custom Forms 1
S MailItem Find Method question Outlook VBA and Custom Forms 6
N Getting the attachments in MailItem Outlook VBA and Custom Forms 1
T How to get MailItem.Body without security warning in Outlook 2010 Outlook VBA and Custom Forms 2
S ->[O2007] Parsing each line of a MailItem HTMLBody? Outlook VBA and Custom Forms 2
T How to get Inspector or MailItem from wordEditor Outlook VBA and Custom Forms 6
A Select the position of an attached file in a HTML mailitem Outlook VBA and Custom Forms 1
M MailItem object has no property for when a reply was sent Outlook VBA and Custom Forms 3
B Insert information to MailItem Outlook VBA and Custom Forms 1
E Properties added to MailItem in ItemSend event visible to recipien Outlook VBA and Custom Forms 1
V Setting HTMLBody of new mailItem Outlook VBA and Custom Forms 1
V How to find mailitem in the inspector is a brand new one Outlook VBA and Custom Forms 2
M Activate "Add digital signature to this massage" on a MailItem? Outlook VBA and Custom Forms 1
K importing EML in MailItem Outlook VBA and Custom Forms 1
A mailitem Send issue Outlook VBA and Custom Forms 5
M Get email address from MailItem.To? Outlook VBA and Custom Forms 6
R How to capture a Mailitem Event Outlook VBA and Custom Forms 3
S get current position in message body of mailitem Outlook VBA and Custom Forms 8
S How to get RFC822 format message from the MailItem object. Outlook VBA and Custom Forms 4
J Toolbar button to process current mailitem Outlook VBA and Custom Forms 1
D MailItem from an RSS feed Outlook VBA and Custom Forms 2
J Outlook 2007 crashed when pushing send on a displayed mailitem Outlook VBA and Custom Forms 1
N Memory with MailItem.Send Outlook VBA and Custom Forms 1

Similar threads

Back
Top