名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
注意
Outlook tasks API は非推奨となり、2022 年 8 月 20 日にデータの返しを停止しました。 代わりに To Do API を 使用します。
ユーザーのメールボックスにある Outlook タスクのプロパティとリレーションシップを取得します。
既定では、この操作 (および POST、PATCH、および 完全な タスク操作) は、UTC で日付関連のプロパティを返します。
Prefer: outlook.timezone ヘッダーを使用して、応答内のすべての日付関連プロパティを UTC 以外のタイム ゾーンで表すことができます。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
❌ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
Tasks.Read |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
Tasks.Read |
注意事項なし。 |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
GET /me/outlook/tasks/{id}
GET /users/{id|userPrincipalName}/outlook/tasks/{id}
オプションのクエリ パラメーター
このメソッドは、応答をカスタマイズするための OData クエリ パラメーターをサポートします。
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| 優先: outlook.timezone |
応答のタイム プロパティのタイム ゾーンを指定します。これは、このヘッダーが指定されていない場合は UTC になります。 省略可能。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは応答コード 200 OK と応答本文の outlookTask オブジェクトを返します。
例
例 1: Outlook タスクを取得する
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/me/outlook/tasks/AAMkADA1MTrgAAA=
// Code snippets are only available for the latest version. Current version is 5.x
// 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}"].GetAsync();
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// 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").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OutlookTask result = graphClient.me().outlook().tasks().byOutlookTaskId("{outlookTask-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let outlookTask = await client.api('/me/outlook/tasks/AAMkADA1MTrgAAA=')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->me()->outlook()->tasks()->byOutlookTaskId('outlookTask-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserOutlookTask -UserId $userId -OutlookTaskId $outlookTaskId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.me.outlook.tasks.by_outlook_task_id('outlookTask-id').get()
応答
次の例は応答を示しています。 既定では、応答に含まれる日時のプロパティは UTC 形式になります。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "AAMkADA1MTrgAAA=",
"createdDateTime": "2016-04-22T06:03:35.9279794Z",
"lastModifiedDateTime": "2016-04-22T06:03:35.9436052Z",
"changeKey": "1/KC9Vmu40G3DwB6Lgs7MAAAIOJMyQ==",
"categories": [],
"assignedTo": null,
"body": {
"contentType": "text",
"content": ""
},
"completedDateTime": null,
"dueDateTime": {
"dateTime": "2016-04-27T04:00:00.0000000",
"timeZone": "UTC"
},
"hasAttachments": false,
"importance": "normal",
"isReminderOn": false,
"owner": "Administrator",
"parentFolderId": "AQMkADA1MTBEgAAAA==",
"recurrence": null,
"reminderDateTime": null,
"sensitivity": "normal",
"startDateTime": {
"dateTime": "2016-04-26T04:00:00.0000000",
"timeZone": "UTC"
},
"status": "notStarted",
"subject": "Shop for dinner"
}
例 2: 太平洋Standard時刻の日付/時刻プロパティを含む Outlook タスクを取得する
要求
この例では、Prefer: outlook.timezone ヘッダーを使用して、API が Pacific Standard Time の応答で日時プロパティを返す必要があることを指定します。
GET https://graph.microsoft.com/beta/me/outlook/tasks/AAMkADA1MHgwAAA=
Prefer: outlook.timezone="Pacific Standard Time"
// Code snippets are only available for the latest version. Current version is 5.x
// 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}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.Headers.Add("Prefer", "outlook.timezone=\"Pacific 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"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "outlook.timezone=\"Pacific Standard Time\"")
configuration := &graphusers.OutlookTasksItemRequestBuilderGetRequestConfiguration{
Headers: headers,
}
// 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").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OutlookTask result = graphClient.me().outlook().tasks().byOutlookTaskId("{outlookTask-id}").get(requestConfiguration -> {
requestConfiguration.headers.add("Prefer", "outlook.timezone=\"Pacific Standard Time\"");
});
const options = {
authProvider,
};
const client = Client.init(options);
let outlookTask = await client.api('/me/outlook/tasks/AAMkADA1MHgwAAA=')
.version('beta')
.header('Prefer','outlook.timezone="Pacific Standard Time"')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\Outlook\Tasks\Item\OutlookTaskItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new OutlookTaskItemRequestBuilderGetRequestConfiguration();
$headers = [
'Prefer' => 'outlook.timezone="Pacific Standard Time"',
];
$requestConfiguration->headers = $headers;
$result = $graphServiceClient->me()->outlook()->tasks()->byOutlookTaskId('outlookTask-id')->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserOutlookTask -UserId $userId -OutlookTaskId $outlookTaskId
# 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
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_configuration = RequestConfiguration()
request_configuration.headers.add("Prefer", "outlook.timezone=\"Pacific Standard Time\"")
result = await graph_client.me.outlook.tasks.by_outlook_task_id('outlookTask-id').get(request_configuration = request_configuration)
応答
次の例は応答を示しています。 応答の日時プロパティは、指定された Pacific Standard Time で返されます。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "AAMkADA1MHgwAAA=",
"createdDateTime": "2016-04-22T15:19:18.9526004-07:00",
"lastModifiedDateTime": "2016-04-22T15:19:19.015101-07:00",
"changeKey": "1/KC9Vmu40G3DwB6Lgs7MAAAIW9XXA==",
"categories": [],
"assignedTo": "Dana Swope",
"body": {
"contentType": "text",
"content": ""
},
"completedDateTime": null,
"dueDateTime": {
"dateTime": "2016-05-04T021:00:00.0000000",
"timeZone": "Pacific Standard Time"
},
"hasAttachments": false,
"importance": "normal",
"isReminderOn": false,
"owner": "Administrator",
"parentFolderId": "AQMkADA1MTEgAAAA==",
"recurrence": null,
"reminderDateTime": null,
"sensitivity": "normal",
"startDateTime": {
"dateTime": "2016-05-02T21:00:00.0000000",
"timeZone": "Pacific Standard Time"
},
"status": "notStarted",
"subject": "Shop for children's weekend"
}