.net - EWS Set EmailMessage.Body.Text error -


i have following code add text email:

msg = new emailmessage(service) msg     .from = new emailaddress(config("outsender"))     .torecipients.add(new emailaddress(config("outrecip")))     .subject = config("outsubject")      .load(new propertyset(itemschema.body))     .body.text = config("protmarking")     .send() end 

i error:

you must load or assign property before can read value

on line:

.body.text = new messagebody(config("protmarking"))

which why tried load body property on line:

.load(new propertyset(itemschema.body))

however i'm getting error:

this operation can't performed because service object doesn't have id

after extensive googling , lot of looking @ code cant figure out. i'm not sure why new email message doesn't have id?

note: service call property returns ews service. have check working properly.

you should set body property (not body.text)

the call load not necessary in case. reference though, isn't working haven't yet created email message on service. happens when send (which should sendandsavecopy()

msg = new emailmessage(service) msg     .from = new emailaddress(config("outsender"))     .torecipients.add(new emailaddress(config("outrecip")))     .subject = config("outsubject")     .body = config("protmarking")     .sendandsavecopy() end 

Comments