-
-
Save zaxy78/8831658e880acdc4f963cb487995c0bb to your computer and use it in GitHub Desktop.
Fetch Appointments using ews-javascript-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ExchangeService, ExchangeVersion, ExchangeCredentials, Uri, DateTime, CalendarView, WellKnownFolderName, EwsLogging } from "ews-javascript-api"; | |
import credentials = require("./credentials"); //for username and password | |
EwsLogging.DebugLogEnabled = false; | |
var service = new ExchangeService(ExchangeVersion.Exchange2010); | |
service.Credentials = new ExchangeCredentials(credentials.userName, credentials.password); | |
service.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx"); | |
var view = new CalendarView(DateTime.Now.Add(-1, "week"), DateTime.Now); // appointments in last one week. | |
service.FindAppointments(WellKnownFolderName.Calendar, view).then((response) => { | |
let appointments = response.Items; | |
let appointment = appointments[0]; | |
console.log("Subject: " + appointment.Subject); | |
console.log("Start Time: " + appointment.Start); | |
console.log("End Time: " + appointment.End); | |
console.log("Recipients: "); | |
appointment.RequiredAttendees.Items.forEach((a) => { | |
console.log(a.Address); | |
}); | |
console.log("unique id: " + appointment.Id.UniqueId, true, true); | |
}, function (error) { | |
console.log(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment