0

List Time Zones

by
Published today

List the time zones the connected mailbox supports, as Windows names (`Pacific Standard Time`) or IANA names (`America/Los_Angeles`). Either form is accepted wherever a script takes `time_zone`. Requires User.Read (a connection default).

Script ms_outlook Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 1 hour ago
1
//native
2

3
/**
4
 * List Time Zones
5
 * List the time zones the connected mailbox supports, as Windows names (`Pacific Standard Time`) or IANA names (`America/Los_Angeles`). Either form is accepted wherever a script takes `time_zone`. Requires User.Read (a connection default).
6
 */
7
export async function main(
8
  auth: RT.MsOutlook,
9
  standard: "Windows" | "Iana" = "Iana"
10
) {
11
  const response = await fetch(
12
    `https://graph.microsoft.com/v1.0/me/outlook/supportedTimeZones(TimeZoneStandard=microsoft.graph.timeZoneStandard'${standard}')`,
13
    {
14
      headers: {
15
        Authorization: `Bearer ${auth.token}`,
16
        Accept: "application/json",
17
      },
18
    }
19
  )
20

21
  if (!response.ok) {
22
    throw new Error(`${response.status} ${await response.text()}`)
23
  }
24

25
  return await response.json()
26
}
27