![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello NG,
I am very new to Outlook2007 and VSTO (Visual Studio 2008) in a mail i have a user defined Named Property "UID" the DASL is http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/UID (I used outlookspy to get this) At the moment I'am looping through all ItemProperties and search for a Property with the Name "UID" to read/write to that property. Is their a better way to directly access such a user defined property? maybe something like: string foo = (string) mail.Properties["UID"]; ? I've read something about the Outlook.PropertyAccessor, but I'am not aure if this is the normal way to read/write a user defiened field. below is a snippet of a csharp code I'am using at the moment. CodeSnippet: ############################################ private void On_btnSave_Click(object sender, EventArgs e) { Outlook.MailItem mail; Outlook.ItemProperties properties; try { if (this.OutlookItem is Outlook.MailItem) { mail = (Outlook.MailItem)this.OutlookItem; properties = mail.ItemProperties; // aender den Betreff wie gewuenscht ab mail.Subject = this._txt1.Text; // suche das UID Propertie! foreach (Outlook.ItemProperty xProperty in properties) { if (xProperty.Name == "UID") { xProperty.Value = this._txt2.Text; break; } } mail.Save(); } } finally { mail = null; properties = null; } } |
Ads |
#2
|
|||
|
|||
![]()
Have youi looked at MailItem.PropertyAccessor?
-- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Michael Schmitz" wrote in message ... Hello NG, I am very new to Outlook2007 and VSTO (Visual Studio 2008) in a mail i have a user defined Named Property "UID" the DASL is http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/UID (I used outlookspy to get this) At the moment I'am looping through all ItemProperties and search for a Property with the Name "UID" to read/write to that property. Is their a better way to directly access such a user defined property? maybe something like: string foo = (string) mail.Properties["UID"]; ? I've read something about the Outlook.PropertyAccessor, but I'am not aure if this is the normal way to read/write a user defiened field. below is a snippet of a csharp code I'am using at the moment. CodeSnippet: ############################################ private void On_btnSave_Click(object sender, EventArgs e) { Outlook.MailItem mail; Outlook.ItemProperties properties; try { if (this.OutlookItem is Outlook.MailItem) { mail = (Outlook.MailItem)this.OutlookItem; properties = mail.ItemProperties; // aender den Betreff wie gewuenscht ab mail.Subject = this._txt1.Text; // suche das UID Propertie! foreach (Outlook.ItemProperty xProperty in properties) { if (xProperty.Name == "UID") { xProperty.Value = this._txt2.Text; break; } } mail.Save(); } } finally { mail = null; properties = null; } } |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Object using VSTO? | Michael Schmitz | Outlook - Using Forms | 5 | April 22nd 09 07:27 PM |
Property tags - what happens if... (Rename of user defined field) | Bert_Bert[_2_] | Outlook and VBA | 13 | September 1st 08 02:48 PM |
How to add a user defined field to Redemption RDOContactItem object? | CataGeek | Add-ins for Outlook | 3 | July 10th 08 12:09 AM |
User Defined Field type property | PocketRocket | Outlook - Using Contacts | 1 | December 15th 07 12:43 AM |
How to create a user-defined field in vsto | [email protected] | Outlook - Using Forms | 4 | September 18th 06 03:55 PM |