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
Post a Comment