0

这是我用来检索 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

如何获得准确的电子邮件地址?

4

2 回答 2

1

使用Recipient.AddressEntry.GetExchangeUser.PrimarySmtpAddress(省略错误/空值检查)。

于 2013-08-19T13:46:21.140 回答
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); 
于 2013-08-19T07:36:47.223 回答