View Single Post
  #5  
Old April 22nd 09, 02:17 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Object using VSTO?

This C# code:

mail.ItemProperties["UID"] or mail.UserProperties["UID"]

is the equivalent of the VB type code:

mail.UserProperties.Item("UID") or mail.ItemProperties.Item("UID")

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


"Sue Mosher [MVP]" wrote in message
...
I have no idea. I write code only for VB languages. Your best reference is
the PIA documentation on MSDN; perhaps the example at
http://msdn.microsoft.com/en-us/library/bb608929.aspx will be helpful.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Michael Schmitz" wrote in message
...

"Sue Mosher [MVP]" schrieb im Newsbeitrag
...
You should be able to use ItemProperties.Item("UID") or
UserProperties.Item("UID").


Thanks Sue that was the right hint to point me to a direction.
My code looks now like this, I guess the above only works for
VB.NET?

Regards

Michael (I got your Book allready )!

codesnipet:
###########################################

mail = (Outlook.MailItem)this.OutlookItem;
this._txt1.Text = "Read:" + mail.Subject;
try
{
this._txt2.Text = mail.ItemProperties["UID"].Value.ToString();
}
catch
{
this._txt2.Text = "???";
}






Ads