Rechazar la invitación al evento especificado en un calendario de usuario.
Si el evento permite propuestas para los nuevos tiempos, al rechazar el evento, un invitado puede optar por sugerir una hora alternativa incluyendo el parámetro proposedNewTime . Para obtener más información sobre cómo proponer una hora y cómo recibir y aceptar una nueva propuesta de hora, vea Proponer nuevas horas de reunión.
Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores 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)
Calendars.ReadWrite
No disponible.
Delegado (cuenta personal de Microsoft)
Calendars.ReadWrite
No disponible.
Aplicación
Calendars.ReadWrite
No disponible.
Solicitud HTTP
POST /me/events/{id}/decline
POST /users/{id | userPrincipalName}/events/{id}/decline
POST /me/calendar/events/{id}/decline
POST /users/{id | userPrincipalName}/calendar/events/{id}/decline
POST /me/calendars/{id}/events/{id}/decline
POST /users/{id | userPrincipalName}/calendars/{id}/events/{id}/decline
POST /me/calendarGroups/{id}/calendars/{id}/events/{id}/decline
POST /users/{id | userPrincipalName}/calendarGroups/{id}/calendars/{id}/events/{id}/decline
Fecha y hora alternativas propuestas por un invitado para que una convocatoria de reunión comience y finalice. Válido solo para eventos que permiten nuevas propuestas de hora. Establecer este parámetro requiere establecer sendResponse en true. Opcional.
sendResponse
Booleano
true si se va a enviar una respuesta al organizador; de lo contrario, false. Opcional. El valor predeterminado es true.
Respuesta
Si se ejecuta correctamente, este método devuelve el código de respuesta 202 Accepted. No devuelve nada en el cuerpo de la respuesta.
Esta acción devuelve HTTP 400 si se produce uno o ambos de los siguientes:
Se incluye el parámetro proposedNewTime , pero la propiedad allowNewTimeProposals del evento es false.
Se incluye el parámetro proposedNewTime , pero el parámetro sendResponse está establecido en false.
POST https://graph.microsoft.com/v1.0/me/events/{id}/decline
Content-type: application/json
{
"comment": "I won't be able to make this week. How about next week?",
"sendResponse": true,
"proposedNewTime": {
"start": {
"dateTime": "2019-12-02T18:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2019-12-02T19:00:00",
"timeZone": "Pacific Standard Time"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Me.Events.Item.Decline;
using Microsoft.Graph.Models;
var requestBody = new DeclinePostRequestBody
{
Comment = "I won't be able to make this week. How about next week?",
SendResponse = true,
ProposedNewTime = new TimeSlot
{
Start = new DateTimeTimeZone
{
DateTime = "2019-12-02T18:00:00",
TimeZone = "Pacific Standard Time",
},
End = new DateTimeTimeZone
{
DateTime = "2019-12-02T19: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
await graphClient.Me.Events["{event-id}"].Decline.PostAsync(requestBody);
mgc users events decline post --user-id {user-id} --event-id {event-id} --body '{\
"comment": "I won't be able to make this week. How about next week?",\
"sendResponse": true,\
"proposedNewTime": {\
"start": { \
"dateTime": "2019-12-02T18:00:00", \
"timeZone": "Pacific Standard Time" \
}, \
"end": { \
"dateTime": "2019-12-02T19:00:00", \
"timeZone": "Pacific Standard Time" \
} \
}\
}\
'
// 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"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphusers.NewItemDeclinePostRequestBody()
comment := "I won't be able to make this week. How about next week?"
requestBody.SetComment(&comment)
sendResponse := true
requestBody.SetSendResponse(&sendResponse)
proposedNewTime := graphmodels.NewTimeSlot()
start := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-12-02T18:00:00"
start.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
start.SetTimeZone(&timeZone)
proposedNewTime.SetStart(start)
end := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-12-02T19:00:00"
end.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
end.SetTimeZone(&timeZone)
proposedNewTime.SetEnd(end)
requestBody.SetProposedNewTime(proposedNewTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Me().Events().ByEventId("event-id").Decline().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.users.item.events.item.decline.DeclinePostRequestBody declinePostRequestBody = new com.microsoft.graph.users.item.events.item.decline.DeclinePostRequestBody();
declinePostRequestBody.setComment("I won't be able to make this week. How about next week?");
declinePostRequestBody.setSendResponse(true);
TimeSlot proposedNewTime = new TimeSlot();
DateTimeTimeZone start = new DateTimeTimeZone();
start.setDateTime("2019-12-02T18:00:00");
start.setTimeZone("Pacific Standard Time");
proposedNewTime.setStart(start);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setDateTime("2019-12-02T19:00:00");
end.setTimeZone("Pacific Standard Time");
proposedNewTime.setEnd(end);
declinePostRequestBody.setProposedNewTime(proposedNewTime);
graphClient.me().events().byEventId("{event-id}").decline().post(declinePostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\Events\Item\Decline\DeclinePostRequestBody;
use Microsoft\Graph\Generated\Models\TimeSlot;
use Microsoft\Graph\Generated\Models\DateTimeTimeZone;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new DeclinePostRequestBody();
$requestBody->setComment('I won\'t be able to make this week. How about next week?');
$requestBody->setSendResponse(true);
$proposedNewTime = new TimeSlot();
$proposedNewTimeStart = new DateTimeTimeZone();
$proposedNewTimeStart->setDateTime('2019-12-02T18:00:00');
$proposedNewTimeStart->setTimeZone('Pacific Standard Time');
$proposedNewTime->setStart($proposedNewTimeStart);
$proposedNewTimeEnd = new DateTimeTimeZone();
$proposedNewTimeEnd->setDateTime('2019-12-02T19:00:00');
$proposedNewTimeEnd->setTimeZone('Pacific Standard Time');
$proposedNewTime->setEnd($proposedNewTimeEnd);
$requestBody->setProposedNewTime($proposedNewTime);
$graphServiceClient->me()->events()->byEventId('event-id')->decline()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Users.Actions
$params = @{
comment = "I won't be able to make this week. How about next week?"
sendResponse = $true
proposedNewTime = @{
start = @{
dateTime = "2019-12-02T18:00:00"
timeZone = "Pacific Standard Time"
}
end = @{
dateTime = "2019-12-02T19:00:00"
timeZone = "Pacific Standard Time"
}
}
}
# A UPN can also be used as -UserId.
Invoke-MgDeclineUserEvent -UserId $userId -EventId $eventId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.users.item.events.item.decline.decline_post_request_body import DeclinePostRequestBody
from msgraph.generated.models.time_slot import TimeSlot
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 = DeclinePostRequestBody(
comment = "I won't be able to make this week. How about next week?",
send_response = True,
proposed_new_time = TimeSlot(
start = DateTimeTimeZone(
date_time = "2019-12-02T18:00:00",
time_zone = "Pacific Standard Time",
),
end = DateTimeTimeZone(
date_time = "2019-12-02T19:00:00",
time_zone = "Pacific Standard Time",
),
),
)
await graph_client.me.events.by_event_id('event-id').decline.post(request_body)