如何从 /me/mailboxSettings/timeZone 返回的 Microsoft Graph API 时区值获取 UTC 偏移量?

How to get UTC offset from Microsoft Graph API's timezone value returned from /me/mailboxSettings/timeZone?

我正在使用 /me/mailboxSettings/timeZone 图表 API 来获取用户的时区信息。

为了找出预期的 return 结果格式,我看到了这个文档:

https://docs.microsoft.com/en-us/graph/api/resources/datetimetimezone?view=graph-rest-1.0

所以 MS Graph 支持的时区似乎是 Windows 和 IANA 时区的混合体。

但是没有文档提到在调用 /me/mailboxSettings/timeZone API.

时应该期望什么样的时区

这是否意味着我在调用此 API 时应该同时遇到 IANA 和 Windows 时区?

如果是这样,有没有一种快速方法可以使用此信息获取时区的当前 UTC 偏移量,而时区可能在 或者 Windows 运行时的IANA格式?

get mailbox settings graph will support both IANA and Windows Timezones depending on the mailbox configuration. There are some questions on how to convert between IANA and Windows timezones see how-to-translate-between-windows-and-iana-time-zones - then you can use TimeZoneInfo 上的文档获取 GetUtcOffset 方法。

希望对您有所帮助,