1

API Example:

I want user's working hours with timezone, I've used getSchedule api to get it

But it's giving time zone which is directly incompatible with python

So, I want timezone as "Asia/Kolkata" not "India Standard Time"

Because I want to implement it in python as follows

import pytz

indian_timezone = pytz.timezone('Asia/Kolkata')

POST /users/{id|userPrincipalName}/calendar/getSchedule
Prefer: outlook.timezone="Pacific Standard Time"
Content-Type: application/json

{        
    "schedules": ["adelev@contoso.onmicrosoft.com", "meganb@contoso.onmicrosoft.com"],
    "startTime": {
        "dateTime": "2019-03-15T09:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "endTime": {
        "dateTime": "2019-03-15T18:00:00",
        "timeZone": "Pacific Standard Time"
    },
    "availabilityViewInterval": 60
}
{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.scheduleInformation)",
    "value": [
        {
            "scheduleId": "msft@msft.com",
            "availabilityView": "0000000",
            "scheduleItems": [],
            "workingHours": {
                "daysOfWeek": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday"
                ],
                "startTime": "08:00:00.0000000",
                "endTime": "17:00:00.0000000",
                "timeZone": {
                    "name": "India Standard Time"
                }
            }
        }
    ]
}

And I need timezone as

 "timeZone": {
        "name": "Asia/Kolkata"
 }

Can I get it with any way with application level credential?

1 Answers1

0

You can refer to point2 mentioned in this sample. This is necessary because Microsoft Graph can return time zones as Windows time zone names, and the Python DateTime library requires IANA time zone identifiers.

Hope this helps. Thanks!

Shweta
  • 351
  • 1
  • 4