Espacio de nombres: microsoft.graph
Obtenga la información de disponibilidad de los miembros del personal de un calendario de Microsoft Bookings.
Disponibilidad de API
Esta API está disponible en las siguientes implementaciones en la nube nacional.
| Servicio global |
Administración pública de EE. UU. |
Gobierno de EE. UU. L5 (DOD) |
China operado por 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Permissions
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use uno o varios permisos con privilegios más altos solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
| Tipo de permiso |
Permisos con privilegios mínimos |
Permisos con privilegios más altos |
| Delegado (cuenta profesional o educativa) |
No admitida. |
No admitida. |
| Delegado (cuenta personal de Microsoft) |
No admitida. |
No admitida. |
| Aplicación |
Bookings.Read.All |
Bookings.Manage.All, Bookings.ReadWrite.All, Calendars.Read, Calendars.ReadWrite |
Solicitud HTTP
POST /solutions/bookingBusinesses/{id}/getStaffAvailability
| Nombre |
Descripción |
| Autorización |
{code} del portador. Obligatorio. |
| Content-Type |
application/json. Obligatorio. |
Cuerpo de la solicitud
En el cuerpo de la solicitud, pase la lista de identificadores del personal junto con otros dos parámetros del tipo de recurso dateTimeTimeZone llamados startDateTime y endDateTime. Estos corresponden a las dos marcas de tiempo entre las que se devolverá la disponibilidad del personal.
Respuesta
Si se realiza correctamente, este método devuelve un 200 OK código de respuesta y una colección staffAvailabilityItem en la respuesta.
Ejemplo
Solicitud
En el ejemplo siguiente se muestra la solicitud.
POST https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/Contosolunchdelivery@contoso.com/getStaffAvailability
Content-Type: application/json
{
"staffIds": [
"311a5454-08b2-4560-ba1c-f715e938cb79"
],
"startDateTime": {
"dateTime": "2022-01-25T00:00:00",
"timeZone": "India Standard Time"
},
"endDateTime": {
"dateTime": "2022-01-26T17:00:00",
"timeZone": "Pacific Standard Time"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Solutions.BookingBusinesses.Item.GetStaffAvailability;
using Microsoft.Graph.Models;
var requestBody = new GetStaffAvailabilityPostRequestBody
{
StaffIds = new List<string>
{
"311a5454-08b2-4560-ba1c-f715e938cb79",
},
StartDateTime = new DateTimeTimeZone
{
DateTime = "2022-01-25T00:00:00",
TimeZone = "India Standard Time",
},
EndDateTime = new DateTimeTimeZone
{
DateTime = "2022-01-26T17:00:00",
TimeZone = "Pacific Standard Time",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BookingBusinesses["{bookingBusiness-id}"].GetStaffAvailability.PostAsGetStaffAvailabilityPostResponseAsync(requestBody);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphsolutions "github.com/microsoftgraph/msgraph-sdk-go/solutions"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphsolutions.NewGetStaffAvailabilityPostRequestBody()
staffIds := []string {
"311a5454-08b2-4560-ba1c-f715e938cb79",
}
requestBody.SetStaffIds(staffIds)
startDateTime := graphmodels.NewDateTimeTimeZone()
dateTime := "2022-01-25T00:00:00"
startDateTime.SetDateTime(&dateTime)
timeZone := "India Standard Time"
startDateTime.SetTimeZone(&timeZone)
requestBody.SetStartDateTime(startDateTime)
endDateTime := graphmodels.NewDateTimeTimeZone()
dateTime := "2022-01-26T17:00:00"
endDateTime.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
endDateTime.SetTimeZone(&timeZone)
requestBody.SetEndDateTime(endDateTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
getStaffAvailability, err := graphClient.Solutions().BookingBusinesses().ByBookingBusinessId("bookingBusiness-id").GetStaffAvailability().PostAsGetStaffAvailabilityPostResponse(context.Background(), requestBody, nil)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.solutions.bookingbusinesses.item.getstaffavailability.GetStaffAvailabilityPostRequestBody getStaffAvailabilityPostRequestBody = new com.microsoft.graph.solutions.bookingbusinesses.item.getstaffavailability.GetStaffAvailabilityPostRequestBody();
LinkedList<String> staffIds = new LinkedList<String>();
staffIds.add("311a5454-08b2-4560-ba1c-f715e938cb79");
getStaffAvailabilityPostRequestBody.setStaffIds(staffIds);
DateTimeTimeZone startDateTime = new DateTimeTimeZone();
startDateTime.setDateTime("2022-01-25T00:00:00");
startDateTime.setTimeZone("India Standard Time");
getStaffAvailabilityPostRequestBody.setStartDateTime(startDateTime);
DateTimeTimeZone endDateTime = new DateTimeTimeZone();
endDateTime.setDateTime("2022-01-26T17:00:00");
endDateTime.setTimeZone("Pacific Standard Time");
getStaffAvailabilityPostRequestBody.setEndDateTime(endDateTime);
var result = graphClient.solutions().bookingBusinesses().byBookingBusinessId("{bookingBusiness-id}").getStaffAvailability().post(getStaffAvailabilityPostRequestBody);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const staffAvailabilityItem = {
staffIds: [
'311a5454-08b2-4560-ba1c-f715e938cb79'
],
startDateTime: {
dateTime: '2022-01-25T00:00:00',
timeZone: 'India Standard Time'
},
endDateTime: {
dateTime: '2022-01-26T17:00:00',
timeZone: 'Pacific Standard Time'
}
};
await client.api('/solutions/bookingBusinesses/Contosolunchdelivery@contoso.com/getStaffAvailability')
.post(staffAvailabilityItem);
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Solutions\BookingBusinesses\Item\GetStaffAvailability\GetStaffAvailabilityPostRequestBody;
use Microsoft\Graph\Generated\Models\DateTimeTimeZone;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new GetStaffAvailabilityPostRequestBody();
$requestBody->setStaffIds(['311a5454-08b2-4560-ba1c-f715e938cb79', ]);
$startDateTime = new DateTimeTimeZone();
$startDateTime->setDateTime('2022-01-25T00:00:00');
$startDateTime->setTimeZone('India Standard Time');
$requestBody->setStartDateTime($startDateTime);
$endDateTime = new DateTimeTimeZone();
$endDateTime->setDateTime('2022-01-26T17:00:00');
$endDateTime->setTimeZone('Pacific Standard Time');
$requestBody->setEndDateTime($endDateTime);
$result = $graphServiceClient->solutions()->bookingBusinesses()->byBookingBusinessId('bookingBusiness-id')->getStaffAvailability()->post($requestBody)->wait();
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Import-Module Microsoft.Graph.Bookings
$params = @{
staffIds = @(
"311a5454-08b2-4560-ba1c-f715e938cb79"
)
startDateTime = @{
dateTime = "2022-01-25T00:00:00"
timeZone = "India Standard Time"
}
endDateTime = @{
dateTime = "2022-01-26T17:00:00"
timeZone = "Pacific Standard Time"
}
}
Get-MgBookingBusinessStaffAvailability -BookingBusinessId $bookingBusinessId -BodyParameter $params
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.solutions.bookingbusinesses.item.get_staff_availability.get_staff_availability_post_request_body import GetStaffAvailabilityPostRequestBody
from msgraph.generated.models.date_time_time_zone import DateTimeTimeZone
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = GetStaffAvailabilityPostRequestBody(
staff_ids = [
"311a5454-08b2-4560-ba1c-f715e938cb79",
],
start_date_time = DateTimeTimeZone(
date_time = "2022-01-25T00:00:00",
time_zone = "India Standard Time",
),
end_date_time = DateTimeTimeZone(
date_time = "2022-01-26T17:00:00",
time_zone = "Pacific Standard Time",
),
)
result = await graph_client.solutions.booking_businesses.by_booking_business_id('bookingBusiness-id').get_staff_availability.post(request_body)
Para obtener más información sobre cómo agregar el SDK al proyecto y crear una instancia de authProvider, consulte la documentación del SDK.
Respuesta
En el ejemplo siguiente se muestra la respuesta.
HTTP/1.1 200 OK
Content-type: application/json
{
"staffAvailabilityItem": [
{
"staffId": "311a5454-08b2-4560-ba1c-f715e938cb79",
"availabilityItems": [
{
"status": "Available",
"startDateTime": {
"dateTime": "2022-01-24T08:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"endDateTime": {
"dateTime": "2022-01-24T15:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"serviceId": ""
},
{
"status": "Busy",
"startDateTime": {
"dateTime": "2022-01-24T15:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"endDateTime": {
"dateTime": "2022-01-24T16:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"serviceId": "57da6774-a087-4d69-b0e6-6fb82c339976"
},
{
"status": "Available",
"startDateTime": {
"dateTime": "2022-01-24T16:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"endDateTime": {
"dateTime": "2022-01-24T17:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"serviceId": ""
},
{
"status": "Available",
"startDateTime": {
"dateTime": "2022-01-25T08:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"endDateTime": {
"dateTime": "2022-01-25T17:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"serviceId": ""
},
{
"status": "Available",
"startDateTime": {
"dateTime": "2022-01-26T08:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"endDateTime": {
"dateTime": "2022-01-26T17:00:00",
"timeZone": "(UTC-08:00) Pacific Time (US & Canada)"
},
"serviceId": ""
}
]
}
]
}