offerShiftRequest: decline
本文内容
命名空间:microsoft.graph
拒绝 offerShiftRequest 对象。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Schedule.ReadWrite.All、Group.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Schedule.ReadWrite.All
HTTP 请求
POST /teams/{teamId}/schedule/offerShiftRequests/{offerShiftRequestId}/decline
名称
说明
Authorization
Bearer {token}。必需。
Content-type
application/json. Required.
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数
类型
描述
message
String
拒绝发送的自定义邮件。
响应
如果成功,此方法返回 200 OK 响应代码。它不在响应正文中返回任何内容。
示例
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/v1.0/teams/{teamId}/schedule/offerShiftRequests/{offerShiftRequestId}/decline
Content-type: application/json
{
"message": "Sorry, you can't offer this shift."
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var message = "Sorry, you can't offer this shift.";
await graphClient.Teams["{team-id}"].Schedule.OfferShiftRequests["{offerShiftRequest-id}"]
.Decline(message)
.Request()
.PostAsync();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
const decline = {
message: 'Sorry, you can\'t offer this shift.'
};
await client.api('/teams/{teamId}/schedule/offerShiftRequests/{offerShiftRequestId}/decline')
.post(decline);
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/teams/{teamId}/schedule/offerShiftRequests/{offerShiftRequestId}/decline"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *message = @"Sorry, you can't offer this shift.";
payloadDictionary[@"message"] = message;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
String message = "Sorry, you can't offer this shift.";
graphClient.teams("{teamId}").schedule().offerShiftRequests("{offerShiftRequestId}")
.decline(ScheduleChangeRequestDeclineParameterSet
.newBuilder()
.withMessage(message)
.build())
.buildRequest()
.post();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档 。
响应
以下示例显示了相应的响应。
HTTP/1.1 200 OK