ews-javascript-api
ews-javascript-api copied to clipboard
Create an appointment by using EWS
Any interest in adding the endpoint to Create an appointment by using EWS? Seems like a high value, low effort addition to this library.
This should already be working.
Have you tried and found it missing?
Hi, not sure if I got your request correctly, but if you mean the option to create an appointment, it is there. You do that by creating new Appointment, passing the service, then setting subject, start, end, etc. and then calling Save().
Hth.
On 19 Oct 2021, 00:04, at 00:04, Josh Arndt @.***> wrote:
Any interest in adding the endpoint to Create an appointment by using EWS? Seems like a high value, low effort addition to this library.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/gautamsi/ews-javascript-api/issues/390
I have tried the following (from the Microsoft example):
var exch = new ews.ExchangeService(ews.ExchangeVersion.Exchange2010_SP1);
exch.Credentials = new ews.WebCredentials(user.email, user.password);
exch.Url = new ews.Uri(user.url);
let meeting = new ews.Appointment(exch)
meeting.Subject="my meeting"
meeting.Body="body"
meeting.Start = ews.DateTime.Now.AddHours(1)
meeting.End = meeting.Start.AddHours(1)
meeting.Location="location"
meeting.Save(ews.SendInvitationsMode.SendToNone).then(x => {
console.log("save ok", x)
}).catch(err => {
console.error("save KO", err)
})
and I get this error:
save KO TypeError: complexProperty.WriteToXml is not a function
at ComplexPropertyDefinition.WritePropertyValueToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/PropertyDefinitions/ComplexPropertyDefinitionBase.js:89:29)
at PropertyBag.WriteToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/PropertyBag.js:560:40)
at Appointment.WriteToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/ServiceObjects/ServiceObject.js:293:43)
at CreateItemRequest.WriteElementsToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/CreateRequest.js:44:17)
at CreateItemRequest.WriteBodyToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:453:14)
at CreateItemRequest.WriteToXml (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:525:14)
at CreateItemRequest.EmitRequest (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:158:18)
at CreateItemRequest.BuildXHR (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/ServiceRequestBase.js:124:14)
at InternalExecute.Promise (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/SimpleServiceRequestBase.js:35:32)
at new Promise (<anonymous>)
at CreateItemRequest.InternalExecute (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/SimpleServiceRequestBase.js:34:16)
at Execute.Promise (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/MultiResponseServiceRequest.js:28:18)
at new Promise (<anonymous>)
at CreateItemRequest.Execute (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/Requests/MultiResponseServiceRequest.js:27:16)
at ExchangeService.InternalCreateItems (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/ExchangeService.js:755:24)
at ExchangeService.CreateItem (/Users/frederic/tmp/microsoft-ews/node_modules/ews-javascript-api/js/Core/ExchangeService.js:552:21)
Any suggestion to make it work? Many thanks!
My bad, I have found in https://github.com/gautamsi/ews-javascript-api/issues/122 that I should use new ews.MessageBody("body")
to set the body.