Reputation: 406
I want to send a reply email. I found this example in microsoft examples on using EWS. The problem is I get this error when running this piece of code.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
EmailMessage mes = new EmailMessage(service);
string replyto = mes.Sender.Address;
Console.WriteLine(replyto);
mes.Subject = "Notification Received";
mes.Body = "Your notification has successfully been added to the site";
mes.ToRecipients.Add(replyto);
mes.Send();
Error: Error: You must load or assign this property before you can read its value.
Upvotes: 2
Views: 2237
Reputation: 31651
mes.Sender.Address
has not been assigned - you cannot read a property until you assign it a value. See EmailMessage.Sender
on MSDN for reference.
Upvotes: 3