//native
/**
* Create Online Meeting
* Create a Teams online meeting organized by the connected user and return its join link (`joinWebUrl`). Start and end are ISO 8601 date-times with an offset; without them the meeting starts now. It does not appear on any calendar: use Outlook's create calendar event for an invitation. Requires OnlineMeetings.ReadWrite (a connection default).
*/
export async function main(
auth: RT.MsTeams,
subject: string,
start_date_time: string | undefined,
end_date_time: string | undefined
) {
const payload: { [key: string]: any } = { subject }
if (start_date_time != null && start_date_time !== "") {
payload.startDateTime = start_date_time
}
if (end_date_time != null && end_date_time !== "") {
payload.endDateTime = end_date_time
}
const response = await fetch(
`https://graph.microsoft.com/v1.0/me/onlineMeetings`,
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify(payload),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 2 hours ago