![]() |
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
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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. |
#3
|
|||
|
|||
![]()
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. |
#4
|
|||
|
|||
![]()
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. |
#5
|
|||
|
|||
![]() "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. |
#6
|
|||
|
|||
![]()
In C# it would be mail1.Recipients[1].
-- 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 ... "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?)" |
#7
|
|||
|
|||
![]()
Thanks Ken, that works.
"Ken Slovak - [MVP - Outlook]" wrote in message ... In C# it would be mail1.Recipients[1]. -- 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 ... "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?)" |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Full email addres for mailItem.To | pjerling | Add-ins for Outlook | 2 | November 23rd 07 08:22 AM |
Email as of type Outlook.MailItem | css | Outlook and VBA | 3 | August 11th 06 06:55 AM |
How do I make a new email address supercede an old email address? | dhbirt | Outlook - Using Contacts | 3 | May 13th 06 05:38 AM |
How can I create a MailItem that displays like a received MailItem ? | Clive | Outlook - Using Forms | 0 | February 27th 06 05:14 PM |
Set which local email account can send mail to contacts in address book. (associating an email address with a contact) | Scott Streit | Outlook - General Queries | 3 | January 27th 06 03:57 PM |