Mark Bertoglio
Posts: 16
Joined: 2009-08-10
|
Hello,
I'd like to do some processing on incoming emails in Outlook. These emails will have custom MIME header allowing me to determine which emails to process. The Outlook.MailItem class doesn't seem to expose the MIME headers. Is what I am doing possible with Add-in Express?
Thanks,
Mark |
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hi Mark,
UPDATE 20-Jul-2016. The code fragments are modified to release the PropertyAccessor COM object.
At http://blogs.msdn.com/b/zainnab/archive/2008/07/01/using-visual-studio-2008-vsto-outlook-to-pull-out-rfc-822-header-data.aspx, I've found the following code:
CS
// get a reference to our mail item
Outlook.MailItem curMail = (Outlook.MailItem)this.OutlookItem;
// use the property accessor to get info into our textBox
Outlook.PropertyAccessor propertyAccessor = curMail.PropertyAccessor;
textBox1.Text = (string)propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E");
Marshal.ReleaseComObject(propertyAccessor); propertyAccessor = null;
VB
' get a reference to our mail item
Dim curMail As Outlook.MailItem = Me.OutlookItem
' use the property accessor to get info into our textbox
Dim propertyAccessor as Outlook.PropertyAccessor = curMail.PropertyAccessor
TextBox1.Text = curMail.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E")
Marshal.ReleaseComObject(propertyAccessor)
propertyAccessor = Nothing
Hope this helps.
Andrei Smolin
Add-in Express Team Leader |
|
Mark Bertoglio
Posts: 16
Joined: 2009-08-10
|
Thanks Andrei, I am using Addin Express 2009 .NET was not finding the PropertyAccessor field in the Outlook.MailItem object. I created my project using the version neutral assemblies. I created a temp project where I selected "Use Primary Interop Assemblies" rather than "Use version neutral assemblies" and the PropertyAccessor field of Outlook.MailItem was available. What are the ramifications of not using version neutral assemblies? Does this mean that my addin will only work with the version of Outlook that I have installed (2007) and not with other versions of Outlook?
Thanks,
Mark |
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
|