Edits history of script submission #23345 for ' List Event Instances (ms_outlook)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * List Event Instances
     * List the occurrences of a recurring event (its series master id) between two ISO 8601 date-times. Each occurrence has its own id: pass it to Update Event or Delete Event to change or cancel that single occurrence. Requires Calendars.Read (covered by the default Calendars.ReadWrite).
     */
    export async function main(
      auth: RT.MsOutlook,
      event_id: string,
      start_date_time: string,
      end_date_time: string,
      top: number = 25,
      next_link: string | undefined,
      time_zone: string = "UTC"
    ) {
      if (
        next_link != null &&
        next_link !== "" &&
        !next_link.startsWith("https://graph.microsoft.com/")
      ) {
        throw new Error(
          "next_link must be an @odata.nextLink returned by Microsoft Graph"
        )
      }
      let url: URL
      if (next_link != null && next_link !== "") {
        url = new URL(next_link)
      } else {
        url = new URL(
          `https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(
            event_id
          )}/instances`
        )
        url.searchParams.append("startDateTime", start_date_time)
        url.searchParams.append("endDateTime", end_date_time)
        url.searchParams.append("$top", String(top))
      }
    
      const response = await fetch(url, {
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
          Prefer: `outlook.timezone="${time_zone}"`,
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 2 hours ago

  • bunnative
    //native
    
    /**
     * List Event Instances
     * List the occurrences of a recurring event (its series master id) between two ISO 8601 date-times. Each occurrence has its own id: pass it to Update Event or Delete Event to change or cancel that single occurrence. Requires Calendars.Read (covered by the default Calendars.ReadWrite).
     */
    export async function main(
      auth: RT.Outlook,
      event_id: string,
      start_date_time: string,
      end_date_time: string,
      top: number = 25,
      next_link: string | undefined,
      time_zone: string = "UTC"
    ) {
      if (
        next_link != null &&
        next_link !== "" &&
        !next_link.startsWith("https://graph.microsoft.com/")
      ) {
        throw new Error(
          "next_link must be an @odata.nextLink returned by Microsoft Graph"
        )
      }
      let url: URL
      if (next_link != null && next_link !== "") {
        url = new URL(next_link)
      } else {
        url = new URL(
          `https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(
            event_id
          )}/instances`
        )
        url.searchParams.append("startDateTime", start_date_time)
        url.searchParams.append("endDateTime", end_date_time)
        url.searchParams.append("$top", String(top))
      }
    
      const response = await fetch(url, {
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
          Prefer: `outlook.timezone="${time_zone}"`,
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 11 hours ago

  • bunnative
    //native
    
    /**
     * List Event Instances
     * List the occurrences of a recurring event (its series master id) between two ISO 8601 date-times. Each occurrence has its own id: pass it to Update Event or Delete Event to change or cancel that single occurrence. Requires Calendars.Read on the connection.
     */
    export async function main(
      auth: RT.Outlook,
      event_id: string,
      start_date_time: string,
      end_date_time: string,
      top: number = 25,
      next_link: string | undefined,
      time_zone: string = "UTC"
    ) {
      if (
        next_link != null &&
        next_link !== "" &&
        !next_link.startsWith("https://graph.microsoft.com/")
      ) {
        throw new Error(
          "next_link must be an @odata.nextLink returned by Microsoft Graph"
        )
      }
      let url: URL
      if (next_link != null && next_link !== "") {
        url = new URL(next_link)
      } else {
        url = new URL(
          `https://graph.microsoft.com/v1.0/me/events/${encodeURIComponent(
            event_id
          )}/instances`
        )
        url.searchParams.append("startDateTime", start_date_time)
        url.searchParams.append("endDateTime", end_date_time)
        url.searchParams.append("$top", String(top))
      }
    
      const response = await fetch(url, {
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
          Prefer: `outlook.timezone="${time_zone}"`,
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 11 hours ago