exchangewebservices - Error while sending Email :you must load or assign this property before you can read its value -EWS -


i error in message.body.bodytype while sending email: must load or assign property before can read value

if (service != null) {        microsoft.exchange.webservices.data.emailmessage message = new microsoft.exchange.webservices.data.emailmessage(service);         message.subject = sendmail.subject;        if (sendmail.ishtml)        {            message.body.bodytype = microsoft.exchange.webservices.data.bodytype.html;            message.body = new microsoft.exchange.webservices.data.messagebody(sendmail.html);        }       } 

you should using bodytype parameter in messagebody overload set bodytype eg

if (service != null) {       microsoft.exchange.webservices.data.emailmessage message = new microsoft.exchange.webservices.data.emailmessage(service);        message.subject = sendmail.subject;      if (sendmail.ishtml)      {             message.body = new microsoft.exchange.webservices.data.messagebody(microsoft.exchange.webservices.data.bodytype.html,sendmail.html);      }       } 

and should work, property trying use useful when reading existing message.

cheers glen


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -