//native
/**
* Update Calendar Event
* Update an event, or one occurrence of a recurring event when given an occurrence id from List Event Instances. Only the fields you set are changed; `attendees` replaces the whole attendee list, and `start`/`end` are local times in `time_zone`. `extra` takes any other event property (e.g. `recurrence`, `isOnlineMeeting`). Requires Calendars.ReadWrite (a connection default).
*/
export async function main(
auth: RT.MsOutlook,
event_id: string,
subject: string | undefined,
start: string | undefined,
end: string | undefined,
time_zone: string = "UTC",
body: string | undefined,
content_type: "HTML" | "Text" = "HTML",
location: string | undefined,
attendees: string[] | undefined,
extra: { [key: string]: any } | undefined
) {
const event: { [key: string]: any } = { ...(extra ?? {}) }
if (subject != null && subject !== "") event.subject = subject
if (start != null && start !== "") {
event.start = { dateTime: start, timeZone: time_zone }
}
if (end != null && end !== "") {
event.end = { dateTime: end, timeZone: time_zone }
}
if (body != null && body !== "") {
event.body = { contentType: content_type, content: body }
}
if (location != null && location !== "") {
event.location = { displayName: location }
}
if (attendees?.length) {
event.attendees = attendees.map((address) => ({
emailAddress: { address },
type: "required",
}))
}
const response = await fetch(
`https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(event_id)}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(event),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago
//native
/**
* Update Calendar Event
* Update an event, or one occurrence of a recurring event when given an occurrence id from List Event Instances. Only the fields you set are changed; `attendees` replaces the whole attendee list, and `start`/`end` are local times in `time_zone`. `extra` takes any other event property (e.g. `recurrence`, `isOnlineMeeting`). Requires Calendars.ReadWrite (a connection default).
*/
export async function main(
auth: RT.Outlook,
event_id: string,
subject: string | undefined,
start: string | undefined,
end: string | undefined,
time_zone: string = "UTC",
body: string | undefined,
content_type: "HTML" | "Text" = "HTML",
location: string | undefined,
attendees: string[] | undefined,
extra: { [key: string]: any } | undefined
) {
const event: { [key: string]: any } = { ...(extra ?? {}) }
if (subject != null && subject !== "") event.subject = subject
if (start != null && start !== "") {
event.start = { dateTime: start, timeZone: time_zone }
}
if (end != null && end !== "") {
event.end = { dateTime: end, timeZone: time_zone }
}
if (body != null && body !== "") {
event.body = { contentType: content_type, content: body }
}
if (location != null && location !== "") {
event.location = { displayName: location }
}
if (attendees?.length) {
event.attendees = attendees.map((address) => ({
emailAddress: { address },
type: "required",
}))
}
const response = await fetch(
`https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(event_id)}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(event),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 11 hours ago
//native
/**
* Update Calendar Event
* Update an event, or one occurrence of a recurring event when given an occurrence id from List Event Instances. Only the fields you set are changed; `attendees` replaces the whole attendee list, and `start`/`end` are local times in `time_zone`. `extra` takes any other event property (e.g. `recurrence`, `isOnlineMeeting`). Requires Calendars.ReadWrite on the connection.
*/
export async function main(
auth: RT.Outlook,
event_id: string,
subject: string | undefined,
start: string | undefined,
end: string | undefined,
time_zone: string = "UTC",
body: string | undefined,
content_type: "HTML" | "Text" = "HTML",
location: string | undefined,
attendees: string[] | undefined,
extra: { [key: string]: any } | undefined
) {
const event: { [key: string]: any } = { ...(extra ?? {}) }
if (subject != null && subject !== "") event.subject = subject
if (start != null && start !== "") {
event.start = { dateTime: start, timeZone: time_zone }
}
if (end != null && end !== "") {
event.end = { dateTime: end, timeZone: time_zone }
}
if (body != null && body !== "") {
event.body = { contentType: content_type, content: body }
}
if (location != null && location !== "") {
event.location = { displayName: location }
}
if (attendees?.length) {
event.attendees = attendees.map((address) => ({
emailAddress: { address },
type: "required",
}))
}
const response = await fetch(
`https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(event_id)}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(event),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 11 hours ago