Namespace: microsoft.graph
Create an instance of an offerShiftRequest.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Schedule.ReadWrite.All |
Group.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Schedule.ReadWrite.All |
Not available. |
HTTP request
POST /teams/{teamId}/schedule/offerShiftRequests
Name |
Description |
Authorization |
Bearer {token}. Required. Learn more about authentication and authorization. |
Content-type |
application/json. Required. |
MS-APP-ACTS-AS |
A user ID (GUID). Required only if the authorization token is an application token; otherwise, optional. |
Request body
Provide the new offerShiftRequest object in the request body for this method.
Response
If successful, this method returns a 200 OK
response code and an offerShiftRequest object in the response body.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/v1.0/teams/788b75d2-a911-48c0-a5e2-dc98480457e3/schedule/offerShiftRequests
Authorization: Bearer {token}
Content-type: application/json
{
"senderShiftId": "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29",
"senderMessage": "Having a family emergency, could you take this shift for me?",
"recipientUserId": "fe278b61-21ac-4872-8b41-1962bbb98e3c"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OfferShiftRequest
{
SenderShiftId = "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29",
SenderMessage = "Having a family emergency, could you take this shift for me?",
RecipientUserId = "fe278b61-21ac-4872-8b41-1962bbb98e3c",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Teams["{team-id}"].Schedule.OfferShiftRequests.PostAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Authorization", "Bearer {token}");
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc teams schedule offer-shift-requests create --team-id {team-id} --body '{\
"senderShiftId": "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29",\
"senderMessage": "Having a family emergency, could you take this shift for me?",\
"recipientUserId": "fe278b61-21ac-4872-8b41-1962bbb98e3c"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
graphteams "github.com/microsoftgraph/msgraph-sdk-go/teams"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Authorization", "Bearer {token}")
configuration := &graphteams.ItemScheduleOfferShiftRequestsRequestBuilderPostRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewOfferShiftRequest()
senderShiftId := "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29"
requestBody.SetSenderShiftId(&senderShiftId)
senderMessage := "Having a family emergency, could you take this shift for me?"
requestBody.SetSenderMessage(&senderMessage)
recipientUserId := "fe278b61-21ac-4872-8b41-1962bbb98e3c"
requestBody.SetRecipientUserId(&recipientUserId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
offerShiftRequests, err := graphClient.Teams().ByTeamId("team-id").Schedule().OfferShiftRequests().Post(context.Background(), requestBody, configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OfferShiftRequest offerShiftRequest = new OfferShiftRequest();
offerShiftRequest.setSenderShiftId("SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29");
offerShiftRequest.setSenderMessage("Having a family emergency, could you take this shift for me?");
offerShiftRequest.setRecipientUserId("fe278b61-21ac-4872-8b41-1962bbb98e3c");
OfferShiftRequest result = graphClient.teams().byTeamId("{team-id}").schedule().offerShiftRequests().post(offerShiftRequest, requestConfiguration -> {
requestConfiguration.headers.add("Authorization", "Bearer {token}");
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const offerShiftRequest = {
senderShiftId: 'SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29',
senderMessage: 'Having a family emergency, could you take this shift for me?',
recipientUserId: 'fe278b61-21ac-4872-8b41-1962bbb98e3c'
};
await client.api('/teams/788b75d2-a911-48c0-a5e2-dc98480457e3/schedule/offerShiftRequests')
.post(offerShiftRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Teams\Item\Schedule\OfferShiftRequests\OfferShiftRequestsRequestBuilderPostRequestConfiguration;
use Microsoft\Graph\Generated\Models\OfferShiftRequest;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OfferShiftRequest();
$requestBody->setSenderShiftId('SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29');
$requestBody->setSenderMessage('Having a family emergency, could you take this shift for me?');
$requestBody->setRecipientUserId('fe278b61-21ac-4872-8b41-1962bbb98e3c');
$requestConfiguration = new OfferShiftRequestsRequestBuilderPostRequestConfiguration();
$headers = [
'Authorization' => 'Bearer {token}',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->teams()->byTeamId('team-id')->schedule()->offerShiftRequests()->post($requestBody, $requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Teams
$params = @{
senderShiftId = "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29"
senderMessage = "Having a family emergency, could you take this shift for me?"
recipientUserId = "fe278b61-21ac-4872-8b41-1962bbb98e3c"
}
New-MgTeamScheduleOfferShiftRequest -TeamId $teamId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.teams.item.schedule.offer_shift_requests.offer_shift_requests_request_builder import OfferShiftRequestsRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph.generated.models.offer_shift_request import OfferShiftRequest
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OfferShiftRequest(
sender_shift_id = "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29",
sender_message = "Having a family emergency, could you take this shift for me?",
recipient_user_id = "fe278b61-21ac-4872-8b41-1962bbb98e3c",
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("Authorization", "Bearer {token}")
result = await graph_client.teams.by_team_id('team-id').schedule.offer_shift_requests.post(request_body, request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.etag": "\"4000ee23-0000-0700-0000-5d1415f60000\"",
"id": "SREQ_0b87dd20-d5ed-4764-9c3e-cfc8516def09",
"createdDateTime": "2019-09-27T01:01:04.566Z",
"lastModifiedDateTime": "2019-09-28T01:03:48.874Z",
"assignedTo": "recipient",
"state": "pending",
"senderDateTime": "2019-09-27T01:01:04.566",
"senderMessage": "Having a family emergency, could you take this shift for me?",
"senderUserId": "a4704dd0-3f4c-4f2c-9bb5-8cc575703f30",
"managerActionDateTime": null,
"managerActionMessage": null,
"managerUserId": null,
"recipientActionDateTime": null,
"recipientActionMessage": null,
"senderShiftId": "SHFT_f7e484ed-fdd6-421c-92d9-0bc9e62e2c29",
"recipientUserId": "fe278b61-21ac-4872-8b41-1962bbb98e3c",
"lastModifiedBy": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "fe278b61-21ac-4872-8b41-1962bbb98e3c",
"displayName": "Employee 1"
}
}
}