[英]How to get the email address from MS outlook 2010?
This is the code I am using to retrieve the MS outlook mail -这是我用来检索 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;
}
}
While retrieving CC email address using MAPI from MS outlook 2010 its giving the output in this format -在使用 MAPI 从 MS Outlook 2010 中检索 CC 电子邮件地址时,它以这种格式提供输出 -
strCcEmails = /O=EXG5/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=Test88067
How to get the exact email address?如何获得确切的电子邮件地址?
使用Recipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress
(省略错误/空检查)。
Try the code from http://msdn.microsoft.com/en-us/library/office/ff868695.aspx尝试来自http://msdn.microsoft.com/en-us/library/office/ff868695.aspx的代码
Specifically:具体来说:
Outlook.PropertyAccessor pa = olRecipient.PropertyAccessor;
string smtpAddress = pa.GetProperty(PR_SMTP_ADDRESS).ToString();
Debug.WriteLine(olRecipient.Name + " SMTP=" + smtpAddress);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.