[英]How to get receiver email from a sent email in EWS?
我在 EWS 中循環發送的項目,並嘗試顯示每個發送的電子郵件、收件人、主題、正文等的詳細信息。但是,我發現發送的 email 消息中的接收者是 null。 如何獲取接收器 email 地址? 我的代碼:
ItemId id = (ItemId)Request["id"]; // this id is the item id of WellKnownFolderName.**SentItems**
EmailMessage current = EmailMessage.Bind(service, id);
La_Subject.Text = current.Subject;
La_From.Text = current.Sender.ToString();
La_Sent.Text = current.DateTimeReceived.ToString();
La_To.Text = current.ReceivedBy.ToString(); // This line error occurs
任何想法?
要獲取郵件的收件人,請使用郵件消息的 DisplayTo 和 DisplayCC 屬性。
或者自己遍歷 ToRecipients 集合並自己構建字符串:
var toRecipients = string.Join(", ",
mail.ToRecipients.Select(
address => string.Format("\"{0}\" <{1}", address.Name, address.Address)));
ReceivedBy 屬性用於委托方案。 請參閱http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.emailmessage.receivedby(v=exchg.80).aspx 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.