Can't get all busy times of meeting rooms using the Office365 Calendar API

时间秒杀一切 提交于 2019-12-02 19:41:11

问题


Trying to fetch calendar events in order to allow a user to pick a time for a meeting where the attendees and the meeting room are available.

We're using Outlook Calendar REST API v2 - findMeetingTimes: https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#FindMeetingTimes

The request returns almost all of the events. For some reason events that were created by the user that executes the request are not included in the response. It means that the meeting room or attendee seem as FREE even though they have an event in their calendar.

Here's a sample request with only the meeting room as attendee. We see the same problematic behavior when requesting events for both meeting rooms and users.

https://outlook.office.com/api/v2.0/users('user@companyname.onmicrosoft.com')/findmeetingtimes

{
    "Attendees": [{
        "Type": "Required",
        "EmailAddress": {
            "Name": "Palo Alto meeting room",
            "Address": "paloalto@companyname.onmicrosoft.com"
        }
    }],
    "TimeConstraint": {
        "Timeslots": [{
            "Start": {
                "DateTime": "2017-02-11T22:00:00",
                "TimeZone": "GMT Standard Time"
            },
            "End": {
                "DateTime": "2017-04-29T20:59:59",
                "TimeZone": "GMT Standard Time"
            }
        }]
    },
    "LocationConstraint": {
        "IsRequired": "false",
        "SuggestLocation": "false",
        "Locations": [{
            "ResolveAvailability": "false",
            "DisplayName": "Palo Alto meeting room",
            "LocationEmailAddress": "paloalto@companyname.onmicrosoft.com"
        }]
    },
    "MinimumAttendeePercentage": "0",
    "MaxCandidates": "1000",
    "ReturnSuggestionReasons": "true"
}

Any help will be much appreciated.


回答1:


Ok, so to clarify, and this is the key point I missed at first: the problem that you're having is that the appointment booked by the authenticated user using the conference room as a location does NOT cause an entry to show up in the FindMeetingTimes response. (At first I thought you were saying it was showing as Free!)

This is correct behavior. FindMeetingTimes is not meant to return an exhaustive list of free/busy results. Rather, it's to find a potential meeting time! The list is based on the availability of the organizer (the authenticated user) and the specified attendees. Because both the organizer AND the room are busy (because the organizer has an appointment already booked in the room), the time slot isn't even presented. When you make the request as another user, they are the organizer, and since they are free at that time, the slot is presented as a possible time.

So I may misunderstand what you're trying to do, but this should work for you. As long as you're only presenting the times returned as possibilities, there isn't a potential for conflict.



来源:https://stackoverflow.com/questions/42466839/cant-get-all-busy-times-of-meeting-rooms-using-the-office365-calendar-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!