使用Microsoft图形可以检查Outlook日历中用户是否有空/忙碌

时间:2018-10-05 18:13:54

标签: json microsoft-graph outlook-restapi

我正在使用/findMeetingTimes发布请求来检查用户是否可以使用Microsoft Graph。我想知道是否还有其他方法可以提高用户的可用性?

以下是我正在使用的通话示例:

请求(POST):

https://graph.microsoft.com/beta/me/findMeetingTimes

身体:

{
  "attendees": [
    {
      "emailAddress": {
        "address": "ricardo.guerrero@email",
        "name": "Ricardo Guerrero Matus"
      },
      "type": "Required"
    }
  ],
  "timeConstraint": {
    "ActivityDomain": "Work",
    "timeslots": [
      {
        "start": {
          "dateTime": "2018-10-05T13:00:00.000Z",
          "timeZone": "Central Standard Time"
        },
        "end": {
          "dateTime": "2018-10-05T14:00:00.000Z",
          "timeZone": "Central Standard Time"
        }
      }
    ]
  },
  "MeetingDuration": "PT1H"
}

1 个答案:

答案 0 :(得分:2)

您可以使用/getSchedule检查用户是否有空/忙碌。如果您有很多用户,则需要一个一个地检查。

请求

 POST https://graph.microsoft.com/beta/me/calendar/getschedule  
 Prefer: outlook.timezone="Pacific Standard Time" 
 Content-Type: application/json

{
  "Schedules": ["AlexW@contoso.OnMicrosoft.com"],
  "StartTime": {
    "dateTime": "2018-08-06T09:00:00",
    "timeZone": "Pacific Standard Time"
  },
  "EndTime": {
    "dateTime": "2018-08-06T18:00:00",
    "timeZone": "Pacific Standard Time"
  },
  "availabilityViewInterval": "15"
}

响应

 HTTP/1.1 200 OK 
 Content-type: application/json

 {
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.scheduleInformation)",
  "value": [
    {
      "scheduleId": "AlexW@contoso.OnMicrosoft.com",
      "availabilityView": "111111002222222200000000000000000000",
      "scheduleItems": [
        {
          "isPrivate": false,
          "status": "Tentative",
          "start": {
            "dateTime": "2018-08-06T09:00:00.0000000",
            "timeZone": "Pacific Standard Time"
          },
          "end": {
            "dateTime": "2018-08-06T10:30:00.0000000",
            "timeZone": "Pacific Standard Time"
          }
        },
        {
          "isPrivate": false,
          "status": "Busy",
          "start": {
            "dateTime": "2018-08-06T11:00:00.0000000",
            "timeZone": "Pacific Standard Time"
          },
          "end": {
            "dateTime": "2018-08-06T13:00:00.0000000",
            "timeZone": "Pacific Standard Time"
          }
        }
      ],
      "workingHours": {
        "daysOfWeek": ["monday", "tuesday", "wednesday", "thursday", "friday"],
        "startTime": "08:00:00.0000000",
        "endTime": "17:00:00.0000000",
        "timeZone": {
          "@odata.type": "#microsoft.graph.customTimeZone",
          "bias": 480,
          "name": "Customized Time Zone",
          "standardOffset": {
            "time": "02:00:00.0000000",
            "dayOccurrence": 1,
            "dayOfWeek": "sunday",
            "month": 11,
            "year": 0
          },
          "daylightOffset": {
            "daylightBias": -60,
            "time": "02:00:00.0000000",
            "dayOccurrence": 2,
            "dayOfWeek": "sunday",
            "month": 3,
            "year": 0
          }
        }
      }
    }
  ]
}

比较/getSchedule/findMeetingTimesHow is getSchedule different from findMeetingTimes