calendario: getSchedulecalendar: getSchedule

Permite obtener información de disponibilidad de una colección de usuarios, listas de distribución o recursos (salas o equipamiento) para un período de tiempo especificado.Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period.

PermisosPermissions

Se requiere uno de los siguientes permisos para llamar a esta API. Para obtener más información, incluido cómo elegir permisos, vea Permisos.One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Tipo de permisoPermission type Permisos (de menos a más privilegiados)Permissions (from least to most privileged)
Delegado (cuenta profesional o educativa)Delegated (work or school account) Calendars.Read, Calendars.ReadWriteCalendars.Read, Calendars.ReadWrite
Delegado (cuenta personal de Microsoft)Delegated (personal Microsoft account) No admitida.Not supported.
ApplicationApplication Calendars.Read, Calendars.ReadWriteCalendars.Read, Calendars.ReadWrite

Solicitud HTTPHTTP request

POST /me/calendar/getSchedule 
POST /users/{id|userPrincipalName}/calendar/getSchedule

Encabezados de solicitudRequest headers

NombreName TipoType DescripciónDescription
AuthorizationAuthorization stringstring {token} de portador. Obligatorio.Bearer {token}. Required.
Content-TypeContent-Type cadenastring Naturaleza de los datos en el cuerpo de una entidad, que es “application/json”.Nature of the data in the body of an entity, which is application/json. Obligatorio.Required.
Prefer: outlook.timezonePrefer: outlook.timezone stringstring Se usa para especificar la zona horaria de las horas de inicio y final de la respuesta.Use this to specify the time zone for start and end times in the response. Si no se especifican, estos valores de hora se devuelven en UTC.If not specified, those time values are returned in UTC. Opcional.Optional.

Cuerpo de solicitudRequest body

En el cuerpo de la solicitud, proporcione un objeto JSON con los siguientes parámetros.In the request body, provide a JSON object with the following parameters.

PropiedadProperty TipoType DescripciónDescription
availabilityViewIntervalavailabilityViewInterval Int32Int32 Representa la duración de una franja temporal en un elemento availabilityView en la respuesta.Represents the duration of a time slot in an availabilityView in the response. El valor predeterminado es de 30 minutos, el mínimo es de 6 y el máximo es de 1440.The default is 30 minutes, minimum is 6, maximum is 1440. Opcional.Optional.
endTimeendTime dateTimeTimeZonedateTimeTimeZone Fecha, hora y zona horaria en que finaliza el evento.The date, time, and time zone that the period ends.
schedulesschedules Colección stringString collection Colección de direcciones SMTP de usuarios, listas de distribución o recursos del que obtener información de disponibilidad.A collection of SMTP addresses of users, distribution lists, or resources to get availability information for.
startTimestartTime dateTimeTimeZonedateTimeTimeZone Fecha, hora y zona horaria en que empieza el evento.The date, time, and time zone that the period starts.

RespuestaResponse

Si es correcta, este método devuelve un código de respuesta 200 OK y una colección de objetos scheduleInformation para cada objeto en el parámetro schedules.If successful, this method returns a 200 OK response code and a collection of scheduleInformation objects for each object in the schedules parameter.

EjemploExample

SolicitudRequest

En el ejemplo siguiente, se obtiene la información de disponibilidad de dos usuarios para la fecha, la hora y la zona horaria especificadas.The following example gets the availability information for two users for the specified date, time, and time zone.

POST https://graph.microsoft.com/v1.0/me/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
}
RespuestaResponse

Aquí tiene un ejemplo de la respuesta. Nota: Puede que el objeto de respuesta que aparece aquí se trunque para abreviar. Todas las propiedades se devolverán de una llamada real.Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.

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

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.scheduleInformation)",
    "value": [
        {
            "scheduleId": "adelev@contoso.onmicrosoft.com",
            "availabilityView": "000220000",
            "scheduleItems": [
                {
                    "isPrivate": false,
                    "status": "busy",
                    "subject": "Let's go for lunch",
                    "location": "Harry's Bar",
                    "start": {
                        "dateTime": "2019-03-15T12:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T14: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": {
                    "name": "Pacific Standard Time"
                }
            }
        },
        {
            "scheduleId": "meganb@contoso.onmicrosoft.com",
            "availabilityView": "200220010",
            "scheduleItems": [
                {
                    "status": "busy",
                    "start": {
                        "dateTime": "2019-03-15T08:30:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T09:30:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    }
                },
                {
                    "status": "busy",
                    "start": {
                        "dateTime": "2019-03-15T12:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T14:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    }
                },
                {
                    "status": "tentative",
                    "start": {
                        "dateTime": "2019-03-15T12:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T13:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    }
                },
                {
                    "status": "busy",
                    "start": {
                        "dateTime": "2019-03-15T13:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T14:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    }
                },
                {
                    "status": "tentative",
                    "start": {
                        "dateTime": "2019-03-15T16:00:00.0000000",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2019-03-15T17: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
                    }
                }
            }
        }
    ]
}