I am working on outlook add-in project using Visual studio 2008 for MS
Outlook 2007 in C#. Here I am explaining my problem...
I got multiple accounts (3 Accounts) with my outlook 2007. I need to get
accounts form Account box in New Mail Message window.
When we click New Mail Message,
a new window will appear from which we can
send
a new mail. Here (On this window) we can see Account Dropdown (Left
side) under the Send Button. If we have multiple accounts with outlook, we
can see all the accounts in Account Drop Down if we click on Account Box. If
we click on the particular email,
a right
mark will appear to that Email
Account and
a message can bee seen on the top of the Send button is "This
message will be sent via
[email protected]".
So, I want to get these email accounts into
a string and that particular
email account (which has right mark) into another string.
I got these 3 email accounts into
a string. But, I am not getting the
particular email account(which has the right
mark when we send
a new email).
I am using this code....
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Interop.Outlook;
Outlook._Application myOutlookApp = new Outlook.Application();
Outlook.Accounts myAccounts = myOutlookApp.Session.Accounts;
foreach (Outlook.Account account in myAccounts)
{
string emailAddress = account.SmtpAddress;
}
I am able to get all the accounts from the above code..But, I just want to get the email address which we will use for sending an email at that particular moment..