名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
注意
Outlook tasks API は非推奨となり、2022 年 8 月 20 日にデータの返しを停止しました。 代わりに To Do API を 使用します。
Outlook タスクの書き込み可能なプロパティを変更します。
completedDateTime プロパティは、完全なアクションによって設定することも、PATCH 操作によって明示的に設定することもできます。 PATCH を使用して completedDateTime を設定する場合は、 状態 も completed に設定してください。
既定では、この操作 (および POST、GET、および 完全な タスク操作) は、UTC で日付関連のプロパティを返します。
Prefer: outlook.timezone ヘッダーを使用して、応答内のすべての日付関連プロパティを UTC 以外のタイム ゾーンで表すことができます。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
Tasks.ReadWrite |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
Tasks.ReadWrite |
注意事項なし。 |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
PATCH /me/outlook/tasks/{id}
PATCH /users/{id|userPrincipalName}/outlook/tasks/{id}
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| 優先: outlook.timezone |
応答のタイム プロパティのタイム ゾーンを指定します。これは、このヘッダーが指定されていない場合は UTC になります。 省略可能。 |
要求本文
要求本文で、更新する関連フィールドの値を指定します。 要求本文に含まれない既存のプロパティは、以前の値のままになるか、他のプロパティ値の変化に基づいて再計算されます。 最適なパフォーマンスを得るためには、変更されていない既存の値を含めないでください。
| プロパティ |
型 |
説明 |
| body |
itemBody |
通常はタスクに関する情報を含むタスク本体。 HTML 型のみがサポートされていることに注意してください。 |
| categories |
String コレクション |
タスクに関連付けられたカテゴリ。 |
| changeKey |
String |
タスクのバージョン。 |
| completedDateTime |
dateTimeTimeZone |
タスクが終了した日付 (指定のタイム ゾーン)。 |
| createdDateTime |
DateTimeOffset |
タスクが作成された日時。 既定では、UTC 時間です。 要求ヘッダーでカスタム タイム ゾーンを使用できます。 プロパティの値は、ISO 8601 形式を使用します。 たとえば、2014 年 1 月 1 日午前 0 時 (UTC) は、2014-01-01T00:00:00Z です。 |
| dueDateTime |
dateTimeTimeZone |
タスクが終了する予定の日時 (指定のタイム ゾーン)。 |
| hasAttachments |
Boolean |
タスクに添付ファイルが含まれている場合、true に設定します。 |
| importance |
string |
イベントの重要度。 使用可能な値: low、normal、high。 |
| isReminderOn |
Boolean |
ユーザーにタスクを通知するアラートを設定する場合は、true に設定します。 |
| lastModifiedDateTime |
DateTimeOffset |
タスクが最後に変更された日時。 既定では、UTC 時間です。 要求ヘッダーでカスタム タイム ゾーンを使用できます。 プロパティの値は、ISO 8601 形式を使って表され、常に UTC 時間です。 たとえば、2014 年 1 月 1 日午前 0 時 (UTC) は、2014-01-01T00:00:00Z です。 |
| owner |
String |
タスクを作成したユーザーの名前。 |
| parentFolderId |
String |
タスクの親フォルダーの一意の識別子。 |
| recurrence |
patternedRecurrence |
タスクの繰り返しパターン。 |
| reminderDateTime |
dateTimeTimeZone |
タスクのアラーム通知を行う日時。 |
| sensitivity |
string |
タスクのプライバシーのレベルを示します。 使用可能な値: normal、personal、private、confidential。 |
| startDateTime |
dateTimeTimeZone |
タスクを開始する日付 (指定のタイム ゾーン)。 |
| status |
string |
タスクの状態または進行状況を示します。 使用可能な値: notStarted、inProgress、completed、waitingOnOthers、deferred。 |
| subject |
String |
タスクのタイトルまたは簡単な説明。 |
応答
成功した場合、このメソッドは 200 OK 応答コードを返し、応答本文で 更新された outlookTask オブジェクトを返します。
例
要求
次の例では dueDateTime プロパティを変更し、Prefer: outlook.timezone ヘッダーを使用して、応答の日付関連プロパティを東部Standard時刻 (EST) で表すように指定します。
PATCH https://graph.microsoft.com/beta/me/outlook/tasks/AAMkADA1MTHgwAAA=
Prefer: outlook.timezone="Eastern Standard Time"
Content-type: application/json
{
"dueDateTime": {
"dateTime": "2016-05-06T16:00:00",
"timeZone": "Eastern Standard Time"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OutlookTask
{
DueDateTime = new DateTimeTimeZone
{
DateTime = "2016-05-06T16:00:00",
TimeZone = "Eastern Standard Time",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Outlook.Tasks["{outlookTask-id}"].PatchAsync(requestBody, (requestConfiguration) =>
{
requestConfiguration.Headers.Add("Prefer", "outlook.timezone=\"Eastern Standard Time\"");
});
// 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"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "outlook.timezone=\"Eastern Standard Time\"")
configuration := &graphusers.OutlookTasksItemRequestBuilderPatchRequestConfiguration{
Headers: headers,
}
requestBody := graphmodels.NewOutlookTask()
dueDateTime := graphmodels.NewDateTimeTimeZone()
dateTime := "2016-05-06T16:00:00"
dueDateTime.SetDateTime(&dateTime)
timeZone := "Eastern Standard Time"
dueDateTime.SetTimeZone(&timeZone)
requestBody.SetDueDateTime(dueDateTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
tasks, err := graphClient.Me().Outlook().Tasks().ByOutlookTaskId("outlookTask-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);
OutlookTask outlookTask = new OutlookTask();
DateTimeTimeZone dueDateTime = new DateTimeTimeZone();
dueDateTime.setDateTime("2016-05-06T16:00:00");
dueDateTime.setTimeZone("Eastern Standard Time");
outlookTask.setDueDateTime(dueDateTime);
OutlookTask result = graphClient.me().outlook().tasks().byOutlookTaskId("{outlookTask-id}").patch(outlookTask, requestConfiguration -> {
requestConfiguration.headers.add("Prefer", "outlook.timezone=\"Eastern Standard Time\"");
});
const options = {
authProvider,
};
const client = Client.init(options);
const outlookTask = {
dueDateTime: {
dateTime: '2016-05-06T16:00:00',
timeZone: 'Eastern Standard Time'
}
};
await client.api('/me/outlook/tasks/AAMkADA1MTHgwAAA=')
.version('beta')
.update(outlookTask);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Outlook\Tasks\Item\OutlookTaskItemRequestBuilderPatchRequestConfiguration;
use Microsoft\Graph\Beta\Generated\Models\OutlookTask;
use Microsoft\Graph\Beta\Generated\Models\DateTimeTimeZone;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OutlookTask();
$dueDateTime = new DateTimeTimeZone();
$dueDateTime->setDateTime('2016-05-06T16:00:00');
$dueDateTime->setTimeZone('Eastern Standard Time');
$requestBody->setDueDateTime($dueDateTime);
$requestConfiguration = new OutlookTaskItemRequestBuilderPatchRequestConfiguration();
$headers = [
'Prefer' => 'outlook.timezone="Eastern Standard Time"',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->me()->outlook()->tasks()->byOutlookTaskId('outlookTask-id')->patch($requestBody, $requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Users
$params = @{
dueDateTime = @{
dateTime = "2016-05-06T16:00:00"
timeZone = "Eastern Standard Time"
}
}
# A UPN can also be used as -UserId.
Update-MgBetaUserOutlookTask -UserId $userId -OutlookTaskId $outlookTaskId -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.users.item.outlook.tasks.item.outlook_task_item_request_builder import OutlookTaskItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from msgraph_beta.generated.models.outlook_task import OutlookTask
from msgraph_beta.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 = OutlookTask(
due_date_time = DateTimeTimeZone(
date_time = "2016-05-06T16:00:00",
time_zone = "Eastern Standard Time",
),
)
request_configuration = RequestConfiguration()
request_configuration.headers.add("Prefer", "outlook.timezone=\"Eastern Standard Time\"")
result = await graph_client.me.outlook.tasks.by_outlook_task_id('outlookTask-id').patch(request_body, request_configuration = request_configuration)
応答
次の例は応答を示しています。 注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "AAMkADA1MTHgwAAA=",
"createdDateTime": "2016-04-22T18:19:18.9526004-04:00",
"lastModifiedDateTime": "2016-04-22T18:38:20.5541528-04:00",
"changeKey": "1/KC9Vmu40G3DwB6Lgs7MAAAIW9XXg==",
"categories": [
],
"assignedTo": null,
"body": {
"contentType": "text",
"content": ""
},
"completedDateTime": null,
"dueDateTime": {
"dateTime": "2016-05-06T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
},
"hasAttachments":false,
"importance": "normal",
"isReminderOn": false,
"owner": "Administrator",
"parentFolderId": "AQMkADA1MTIBEgAAAA==",
"recurrence": null,
"reminderDateTime": null,
"sensitivity": "normal",
"startDateTime": {
"dateTime": "2016-05-03T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
},
"status": "notStarted",
"subject": "Shop for children's weekend"
}