nmarus / node-ews

A simple JSON wrapper for the Exchange Web Services (EWS) SOAP API.
MIT License
116 stars 52 forks source link

because the parent element's content model is text only CreateItem Email #62

Closed edwinlimlx closed 7 years ago

edwinlimlx commented 7 years ago

Hi,

I've tried many examples with structuring the JSON request for different services and it works great. However I encounter an interesting on in CreateItem for Email.

https://msdn.microsoft.com/en-us/library/office/aa566468#sectionSection0 This is one special case where I need to enter attribute and text/value into the "Body" field. How do I structure that in the JSON format?

tried doing the below, but it return "The request failed schema validation: The element 'http://schemas.microsoft.com/exchange/services/2006/types:Body' cannot contain child element 'http://schemas.microsoft.com/exchange/services/2006/types:text' because the parent element's content model is text only."

"Body": { "attributes": { "BodyType": "HTML" }, "text": "test" }

The Full ewsArgs. let ewsArgs = { "attributes": { "MessageDisposition": "SendAndSaveCopy" }, "SavedItemFolderId": { "DistinguishedFolderId": { "attributes": { "Id": "sentitems" } } }, "Items": { "Message": { "Subject": "Test Subject", "Body": { "attributes": { "BodyType": "HTML" } }, "ToRecipients": { "Mailbox": { "EmailAddress": "test@test.com" } } } } };

edwinlimlx commented 7 years ago

my bad, found the answer, "$value"

kcastrotech commented 7 years ago

Yep! Glad you figured it out.