I have the following code to simply add text to an email:
msg = New EmailMessage(Service)
With 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 With
I get the error:
You must load or assign this property before you can read its value
on this line:
.Body.Text = New MessageBody(Config("protMarking"))
Which is why I tried to load the body property on this line:
.Load(New PropertySet(ItemSchema.Body))
However I'm now getting this error:
This operation can't be performed because this service object doesn't have an Id
After extensive googling and a lot of looking at my code I cant figure it out. I'm not sure why the new email message doesn't have an ID?
NOTE: Service
is call to a property that returns the ews service. I have check that this is working properly.