开发者

How to get receiver email from a sent email in EWS?

开发者 https://www.devze.com 2023-03-20 07:52 出处:网络
I\'m looping sent item in EWS, and try to show details of each sent emails, receiver, subject, body etc. However, I found receiver in the sent email message is null. How to get receiver email address?

I'm looping sent item in EWS, and try to show details of each sent emails, receiver, subject, body etc. However, I found receiver in the sent email message is null. How to get receiver email address? My code:

ItemId id = (ItemId)Request["id"]; // this id is the item id of WellKnownFolderName.**SentItems**
        EmailMessage current = EmailMessage.Bind(service, id);
        La_Subject.Text开发者_Go百科 = current.Subject;
        La_From.Text = current.Sender.ToString();
        La_Sent.Text = current.DateTimeReceived.ToString();
        La_To.Text = current.ReceivedBy.ToString(); // This line error occurs

Any idea?


To get the recipients of a mail, use the DisplayTo and DisplayCC properties of the mail message.

Or iterate through the ToRecipients collection yourself and build the string yourself:

var toRecipients = string.Join(", ",
    mail.ToRecipients.Select(
        address => string.Format("\"{0}\" <{1}", address.Name, address.Address)));

The ReceivedBy property is used in delegate scenarios. See http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.emailmessage.receivedby(v=exchg.80).aspx.

0

精彩评论

暂无评论...
验证码 换一张
取 消