|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding custom property (Outlook User defined columns) in Exchange OnSyncSave EventI want to write an Exchange Event Sink to add a user defined column which should be displayed in Outlook. I want to know - How to define a user defined column in the Event ( I believe we add a custom property to the email message and it appears as a user defined column in Outlook). I have managed to write a sample Event sync which modifies the subject of the email as it arrives. But I also want to add a custom property/ USer defined field which can be displayed in a column in Outlook. My code - public void OnSyncSave(IExStoreEventInfo pEventInfo, string bstrURLItem, int lFlags) { WriteMessage("Event fired with lFlags = " + lFlags ); try { IExStoreDispEventInfo DispInfo ; DispInfo = (IExStoreDispEventInfo)pEventInfo; ADODB.Record ado_rec; ado_rec = (ADODB.Record)DispInfo.EventRecord; //String Subject; ado_rec.Fields["urn:schemas:mailheader:subject"].Value = "D - This is a demo" + ado_rec.Fields["urn:schemas:mailheader:subject"].Value + ")"; ado_rec.Fields["urn:schemas:AAAA"].Value = "CUSTM VALUE"; //Try to add a custom property AAAA . But I think I am wrong in specifying the URN Schema. ado_rec.Fields["urn:schemas:mailheader:CC"].Value = "22***@123.com"; ado_rec.Fields["urn:schemas:mailheader:Categories"].Value = "ABCDEDF"; ado_rec.Fields["urn:schemas:httpmail:messageflag"].Value = true; ado_rec.Fields["urn:schemas:mailheader:x-message-flag"].Value = true; ado_rec.Fields.Update(); ado_rec.Close(); } catch (Exception ex) { WriteMessage("ERROR MESSAGE..." + ex.Message + " " + ex.ToString()); } } You need to look at using a Mapi editor like Outlook Spy or Mfcmapi to work
out what the propname is for the custom attribute you want to set. Eg your custom prop should be in (PS_PUBLIC_STRINGS) http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ see http://msdn2.microsoft.com/en-us/library/ms526761.aspx then just use this eg ado_rec.Fields["http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/0x8...."].Value Cheers Glen Show quote "Triv" <triven***@gmail.com> wrote in message news:1178095070.955477.159980@q75g2000hsh.googlegroups.com... > Hi experts, > > I want to write an Exchange Event Sink to add a user defined column > which should be displayed in Outlook. > > I want to know - > How to define a user defined column in the Event ( I believe we add a > custom property to the email message and it appears as a user defined > column in Outlook). > > I have managed to write a sample Event sync which modifies the subject > of the email as it arrives. But I also want to add a custom property/ > USer defined field which can be displayed in a column in Outlook. > > My code - > public void OnSyncSave(IExStoreEventInfo pEventInfo, string > bstrURLItem, int lFlags) > { > WriteMessage("Event fired with lFlags = " + lFlags ); > > try > { > IExStoreDispEventInfo DispInfo ; > DispInfo = (IExStoreDispEventInfo)pEventInfo; > > ADODB.Record ado_rec; > ado_rec = (ADODB.Record)DispInfo.EventRecord; > //String Subject; > > ado_rec.Fields["urn:schemas:mailheader:subject"].Value = "D - This > is a demo" + ado_rec.Fields["urn:schemas:mailheader:subject"].Value + > ")"; > > ado_rec.Fields["urn:schemas:AAAA"].Value = "CUSTM VALUE"; > //Try to add a custom property AAAA . But I think I am wrong in > specifying the URN Schema. > > > ado_rec.Fields["urn:schemas:mailheader:CC"].Value = "22***@123.com"; > ado_rec.Fields["urn:schemas:mailheader:Categories"].Value = > "ABCDEDF"; > ado_rec.Fields["urn:schemas:httpmail:messageflag"].Value = true; > ado_rec.Fields["urn:schemas:mailheader:x-message-flag"].Value = > true; > > ado_rec.Fields.Update(); > > ado_rec.Close(); > > } > catch (Exception ex) > { > WriteMessage("ERROR MESSAGE..." + ex.Message + " " + > ex.ToString()); > } > } > |
|||||||||||||||||||||||