简体   繁体   English

如何从 MS Outlook 2010 获取电子邮件地址?

[英]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.

相关问题 如何从 MS Outlook 2010 中检索 CC 电子邮件地址? - How to retrieve CC email address from MS outlook 2010? 如何从Outlook获取发件人的电子邮件地址? - How to get the sender's email address from Outlook? 从MS Outlook邮件中读取发件人的电子邮件地址 - Read sender's email address from MS Outlook mail Outlook帐户-如何获取Exchange电子邮件地址? - Outlook Accounts - How to get the Exchange Email address? 如何使用c#从具有MultiAccount的Outlook 2010中的“撰写邮件”窗口中的(发件人)邮件地址获取信息? - how to get from(sender) mail address in Compose mail window in outlook 2010 having MultiAccount using c#? VSTO - 如何从 Outlook.Store 实体获取帐户 email 地址 - VSTO - How get account email address from Outlook.Store entity Outlook Exchange Office 365:如何从访问令牌获取电子邮件地址? - Outlook Exchange Office 365: How to get email address from access token? 尝试从Microsoft Outlook 2010中提取发件人电子邮件地址并将其与字符串进行比较时出错 - Error trying to pull sender email address from microsoft outlook 2010 and comparing it to a string 如何根据 Outlook 插件中的收件箱点击获取电子邮件地址? - How to get email address based on inbox click in outlook addin? Outlook Calendar Interop-如何获取发件人的电子邮件地址? - Outlook Calendar Interop - How to get Senders Email Address?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM