命名空间:microsoft.graph
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新 plannerPlan 对象的属性。
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
Tasks.ReadWrite |
Group.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
Tasks.ReadWrite.All |
不可用。 |
HTTP 请求
PATCH /planner/plans/{plan-id}
| 名称 |
说明 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| If-Match |
要更新 plannerPlan 的最后已知 ETag 值。 必填。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
响应
如果成功,此方法返回 204 No Content 响应和空内容。 如果请求指定具有首选项的Preferreturn=representation标头,则此方法在响应正文中返回200 OK响应代码和更新的 plannerPlan 对象。
此方法可以返回任何 HTTP 状态代码。 应用应为此方法处理的最常见错误是 400、403、404、409 和 412 响应。 有关这些错误的详细信息,请参阅 Common Planner 错误条件。
示例
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/planner/plans/{id}
Content-type: application/json
Prefer: return=representation
If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
{
"title": "title-value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PlannerPlan
{
Title = "title-value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Planner.Plans["{plannerPlan-id}"].PatchAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Prefer", "return=representation");
requestConfiguration.Headers.Add("If-Match", "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"");
});
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
graphplanner "github.com/microsoftgraph/msgraph-beta-sdk-go/planner"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "return=representation")
headers.Add("If-Match", "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"")
configuration := &graphplanner.PlansItemRequestBuilderPatchRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewPlannerPlan()
title := "title-value"
requestBody.SetTitle(&title)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
plans, err := graphClient.Planner().Plans().ByPlannerPlanId("plannerPlan-id").Patch(context.Background(), requestBody, configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PlannerPlan plannerPlan = new PlannerPlan();
plannerPlan.setTitle("title-value");
PlannerPlan result = graphClient.planner().plans().byPlannerPlanId("{plannerPlan-id}").patch(plannerPlan, requestConfiguration -> {
requestConfiguration.headers.add("Prefer", "return=representation");
requestConfiguration.headers.add("If-Match", "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"");
});
const options = {
authProvider,
};
const client = Client.init(options);
const plannerPlan = {
title: 'title-value'
};
await client.api('/planner/plans/{id}')
.version('beta')
.update(plannerPlan);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Planner\Plans\Item\PlannerPlanItemRequestBuilderPatchRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Models\PlannerPlan;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PlannerPlan();
$requestBody->setTitle('title-value');
$requestConfiguration = new PlannerPlanItemRequestBuilderPatchRequestConfiguration();
$headers = [
'Prefer' => 'return=representation',
'If-Match' => 'W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->planner()->plans()->byPlannerPlanId('plannerPlan-id')->patch($requestBody, $requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Planner
$params = @{
title = "title-value"
}
Update-MgBetaPlannerPlan -PlannerPlanId $plannerPlanId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.planner.plans.item.planner_plan_item_request_builder import PlannerPlanItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.models.planner_plan import PlannerPlan
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PlannerPlan(
title = "title-value",
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("Prefer", "return=representation")
request_configuration.headers.add("If-Match", "W/\"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc=\"")
result = await graph_client.planner.plans.by_planner_plan_id('plannerPlan-id').patch(request_body, request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"createdBy": {
"application": {
"id": "95e27074-6c4a-447a-aa24-9d718a0b86fa"
},
"user": {
"id": "ebf3b108-5234-4e22-b93d-656d7dae5874"
}
},
"createdDateTime": "2015-03-30T18:36:49.2407981Z",
"container": {
"@odata.type": "microsoft.graph.plannerPlanContainer",
"url": "https://graph.microsoft.com/beta/groups/ebf3b108-5234-4e22-b93d-656d7dae5874",
"containerId": "ebf3b108-5234-4e22-b93d-656d7dae5874",
"type": "group"
},
"title": "title-value",
"id": "xqQg5FS2LkCp935s-FIFm2QAFkHM"
}