Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Graph JS
>
Tutorial
> Create daily recurring appointment
The following example shows you how to create a daily recurring appointment.
import { GraphClient, ItemBody, ContentType } from '../independentsoft/graph/graph.js'; import { Event, DateTimeTimeZone, Recurrence, RecurrencePattern, RecurrencePatternType, RecurrenceRange, RecurrenceRangeType } from '../independentsoft/graph/calendars.js'; import { UserId } from '../independentsoft/graph/users.js'; async function mainFunc() { try { const client = new GraphClient(); client.clientId = "xxxxxxxxxx-209e-454e-xxxxxxxxxxxxxxxxxxx"; client.tenant = "independentsoft.onmicrosoft.com"; client.clientSecret = "xxxxxxxxx.ONVE[=zYYxxxxxxxxxxxxxxxx"; const start = new Date(2025, 6, 10, 16, 0, 0); const end = new Date(2025, 6, 10, 17, 0, 0); let pattern = new RecurrencePattern(); pattern.interval = 1; pattern.type = RecurrencePatternType.DAILY; let range = new RecurrenceRange(); range.type = RecurrenceRangeType.END_DATE; range.startDate = start; range.endDate = new Date(2025, 11, 30); range.recurrenceTimeZone = "UTC"; let appointment = new Event(); appointment.recurrence = new Recurrence(pattern, range); appointment.subject = "Development meeting every day"; appointment.body = new ItemBody("
Meeting description
", ContentType.HTML); appointment.start = new DateTimeTimeZone(start, "UTC"); appointment.end = new DateTimeTimeZone(end, "UTC"); const createdAppointment = await client.createEvent(appointment, undefined, new UserId("info@independentsoft.onmicrosoft.com")); console.log("Id = " + createdAppointment.id); } catch (e) { console.error(e.code) //error code console.error(e.message) //description console.error(e.date) //timestamp console.error(e.innerError) //innerError } } mainFunc();
Need help? Ask our developers:
Name*
Email*
Message*