这是我用来检索MS Outlook邮件的代码 -
NameSpace _nameSpace;
ApplicationClass _app;
_app = new ApplicationClass();
_nameSpace = _app.GetNamespace("MAPI");
object o = _nameSpace.GetItemFromID(EntryIDCollection);
MailItem Item = (MailItem)o;
string HTMLbpdyTest = Item.HTMLBody;
CreationTime = Convert.ToString(Item.CreationTime);
Outlook.Recipients olRecipients = default(Outlook.Recipients);
olRecipients = Item.Recipients;
string strCcEmails = string.Empty;
foreach (Outlook.Recipient olRecipient in Item.Recipients)
{
if (olRecipient.Type == Outlook.OlMailRecipientType.olCC)
{
strCcEmails = olRecipient.Address;
}
}
从MS Outlook 2010使用MAPI检索CC电子邮件地址时,以此格式提供输出 -
strCcEmails = /O=EXG5/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=Test88067
如何获取确切的电子邮件地址?
答案 0 :(得分:0)
尝试http://msdn.microsoft.com/en-us/library/office/ff868695.aspx
中的代码具体做法是:
Outlook.PropertyAccessor pa = olRecipient.PropertyAccessor;
string smtpAddress = pa.GetProperty(PR_SMTP_ADDRESS).ToString();
Debug.WriteLine(olRecipient.Name + " SMTP=" + smtpAddress);
答案 1 :(得分:0)
使用Recipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress(省略错误/空检查)。