命名空间:microsoft.graph
与 计划 成员共享计划时间范围。
此操作可让指定团队成员(包括员工和经理)查看日程指定时间范围内的班次、开班和 timeOff 项目的集合。
计划中的每个班次、openshift 和 timeOff 实例都支持项目的草稿版本和共享版本。 草稿版本只能由经理查看,共享版本可由员工和经理查看。 对于指定时间范围内的每个 班次、 openshift 和 timeOff 实例,共享操作会从草稿版本更新共享版本,以便除了经理之外,员工还可以查看有关该项的最新信息。
notifyTeam 参数进一步指定哪些员工可以查看该项。
注意: 若要简化用户体验,请更新所有草稿属性,然后以单个操作的形式共享日期范围内所有挂起的更改。 属性的草稿版本必须为空,然后才能更新项目的共享版本。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
❌ |
❌ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
Schedule.ReadWrite.All |
Group.ReadWrite.All |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
Schedule.ReadWrite.All |
不可用。 |
HTTP 请求
POST /teams/{teamId}/schedule/share
标头 |
值 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type |
application/json. 必需。 |
MS-APP-ACTS-AS |
GUID) (用户 ID。 仅当授权令牌是应用程序令牌时才需要;否则为可选。 |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数 |
类型 |
说明 |
notifyTeam |
Boolean |
指示整个团队是应收到此操作的可见通知,还是仅应向其分配了已共享的班次的员工。 必填。 |
startDateTime |
DateTimeOffset |
按计划共享班次的开始时间。 必填。 |
endDateTime |
DateTimeOffset |
共享排班的结束时间按计划到。 |
响应
如果成功,此方法返回 200 OK
响应代码。 它不会在响应正文中返回任何内容。
示例
请求
下面是请求的示例。
POST https://graph.microsoft.com/v1.0/teams/{teamId}/schedule/share
Content-type: application/json
{
"notifyTeam": true,
"startDateTime": "2018-10-08T00:00:00.000Z",
"endDateTime": "2018-10-15T00:00:00.000Z"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Teams.Item.Schedule.Share;
var requestBody = new SharePostRequestBody
{
NotifyTeam = true,
StartDateTime = DateTimeOffset.Parse("2018-10-08T00:00:00.000Z"),
EndDateTime = DateTimeOffset.Parse("2018-10-15T00:00:00.000Z"),
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Teams["{team-id}"].Schedule.Share.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc teams schedule share post --team-id {team-id} --body '{\
"notifyTeam": true,\
"startDateTime": "2018-10-08T00:00:00.000Z",\
"endDateTime": "2018-10-15T00:00:00.000Z"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphteams "github.com/microsoftgraph/msgraph-sdk-go/teams"
//other-imports
)
requestBody := graphteams.NewSharePostRequestBody()
notifyTeam := true
requestBody.SetNotifyTeam(¬ifyTeam)
startDateTime , err := time.Parse(time.RFC3339, "2018-10-08T00:00:00.000Z")
requestBody.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2018-10-15T00:00:00.000Z")
requestBody.SetEndDateTime(&endDateTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Teams().ByTeamId("team-id").Schedule().Share().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.teams.item.schedule.share.SharePostRequestBody sharePostRequestBody = new com.microsoft.graph.teams.item.schedule.share.SharePostRequestBody();
sharePostRequestBody.setNotifyTeam(true);
OffsetDateTime startDateTime = OffsetDateTime.parse("2018-10-08T00:00:00.000Z");
sharePostRequestBody.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2018-10-15T00:00:00.000Z");
sharePostRequestBody.setEndDateTime(endDateTime);
graphClient.teams().byTeamId("{team-id}").schedule().share().post(sharePostRequestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const share = {
notifyTeam: true,
startDateTime: '2018-10-08T00:00:00.000Z',
endDateTime: '2018-10-15T00:00:00.000Z'
};
await client.api('/teams/{teamId}/schedule/share')
.post(share);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Teams\Item\Schedule\Share\SharePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SharePostRequestBody();
$requestBody->setNotifyTeam(true);
$requestBody->setStartDateTime(new \DateTime('2018-10-08T00:00:00.000Z'));
$requestBody->setEndDateTime(new \DateTime('2018-10-15T00:00:00.000Z'));
$graphServiceClient->teams()->byTeamId('team-id')->schedule()->share()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Teams
$params = @{
notifyTeam = $true
startDateTime = [System.DateTime]::Parse("2018-10-08T00:00:00.000Z")
endDateTime = [System.DateTime]::Parse("2018-10-15T00:00:00.000Z")
}
Invoke-MgShareTeamSchedule -TeamId $teamId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.teams.item.schedule.share.share_post_request_body import SharePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = SharePostRequestBody(
notify_team = True,
start_date_time = "2018-10-08T00:00:00.000Z",
end_date_time = "2018-10-15T00:00:00.000Z",
)
await graph_client.teams.by_team_id('team-id').schedule.share.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
以下是响应示例。
HTTP/1.1 200 OK
相关内容
Microsoft Graph 特定于服务的节流限制