View Single Post
  #5  
Old September 3rd 09, 08:11 AM posted to microsoft.public.outlook.program_addins
Mark B[_2_]
external usenet poster
 
Posts: 93
Default Get email address from MailItem.To?


"Error 7 'Microsoft.Office.Interop.Outlook.Recipients' does not contain a
definition for 'Item' and no extension method 'Item' accepting a first
argument of type 'Microsoft.Office.Interop.Outlook.Recipients' could be
found (are you missing a using directive or an assembly reference?)"



"Dmitry Streblechenko" wrote in message
...
mail1.Recipients.Item(1).Address
should work.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Mark B" wrote in message
...
Please excuse any newbie ignorance on this but I put a breakpoint after
the following code to see what mail.Recipients would expose for me in the
immediate window:

Outlook.MailItem mail1 = Item as Outlook.MailItem;
mail1.Save();

I could get mail1.Recipients.Count to return me 1. I thought
mail1.Recipients(1).emailaddress or similar would return me the raw email
address of the first recipient but I couldn't see that type of thing.

What code would I need to return me the email address?



"Ken Slovak - [MVP - Outlook]" wrote in message
...
Trap the item.Send() event and in that event save the item then read the
recipient properties you want.

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


"Mark B" wrote in message
...
VSTO OL2007 C#

When I am sending an email, how do I extract the email address
component from the TO field?

MailItem.Recipients field doesn't have any objects in the list before
Outlook sends an item. MailItem.To just has address book names and not
email addresses.





Ads