名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
driveItem をアーカイブします。
同期要求を使用して 1 つのアクティブなファイルをアーカイブすると、ファイルはすぐにアーカイブされます。
注:
要求に Prefer: respond-async ヘッダーが含まれている場合、driveItem ファイルのアーカイブはサポートされません。
非同期要求を使用してフォルダーをアーカイブすると、 応答でモニター URL が返されます。 操作が完了するまで進行状況を追跡するには、モニター URL を使用します。
注:
driveItem フォルダーのアーカイブは、要求に Prefer: respond-async ヘッダーが含まれている場合にのみサポートされます。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
Files.ReadWrite |
Files。読み取り、Files。Read.All、Files。ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
Files.ReadWrite |
Files。読み取り、Files。Read.All、Files。ReadWrite.All |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
POST /drive/root/archive
POST /drives/{drivesId}/root/archive
POST /shares/{sharesId}/root/archive
POST /drives/{drivesId}/items/{driveItemId}/archive
POST /drive/items/{driveItemId}/archive
POST /shares/{sharesId}/driveItem/archive
POST /drive/bundles/{driveItemId}/archive
POST /drive/special/{driveItemId}/archive
POST /drive/following/{driveItemId}/archive
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Prefer |
respond-async。 要求が非同期要求であることを示します。 省略可能。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このアクションは driveItem ファイルの204 No Content応答コードを返します。
それ以外の場合、成功した場合、このアクションは、driveItem フォルダーの202 Accepted応答コードとモニター URI が返されます。
例
例 1: driveItem ファイルアーカイブ
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/drives/b!fMInbiL5dkK51VbATG0ddrCg6AJpEj9Lm4uGj5HgEi4guyuYp4W5SbH4dPfXTbCF/items/014Y52UITTNSVUQI43PZBJMKLAY6LJBUVE/archive
// 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
await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Archive.PostAsync();
// 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
graphClient.Drives().ByDriveId("drive-id").Items().ByDriveItemId("driveItem-id").Archive().Post(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").archive().post();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/drives/b!fMInbiL5dkK51VbATG0ddrCg6AJpEj9Lm4uGj5HgEi4guyuYp4W5SbH4dPfXTbCF/items/014Y52UITTNSVUQI43PZBJMKLAY6LJBUVE/archive')
.version('beta')
.post();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->archive()->post()->wait();
Import-Module Microsoft.Graph.Beta.Files
Invoke-MgBetaArchiveDriveItem -DriveId $driveId -DriveItemId $driveItemId
# 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
await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').archive.post()
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 204 No Content
例 2: driveItem フォルダーアーカイブ
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/drives/b!fMInbiL5dkK51VbATG0ddrCg6AJpEj9Lm4uGj5HgEi4guyuYp4W5SbH4dPfXTbCF/items/014Y52UITTNSVUQI43PZBJMKLAY6LJBUVE/archive
Prefer: respond-async
// 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
await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Archive.PostAsync((requestConfiguration) =>
{
requestConfiguration.Headers.Add("Prefer", "respond-async");
});
// 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"
graphdrives "github.com/microsoftgraph/msgraph-beta-sdk-go/drives"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("Prefer", "respond-async")
configuration := &graphdrives.ItemItemsItemArchiveRequestBuilderPostRequestConfiguration{
Headers: headers,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Drives().ByDriveId("drive-id").Items().ByDriveItemId("driveItem-id").Archive().Post(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").archive().post(requestConfiguration -> {
requestConfiguration.headers.add("Prefer", "respond-async");
});
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/drives/b!fMInbiL5dkK51VbATG0ddrCg6AJpEj9Lm4uGj5HgEi4guyuYp4W5SbH4dPfXTbCF/items/014Y52UITTNSVUQI43PZBJMKLAY6LJBUVE/archive')
.version('beta')
.post();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Drives\Item\Items\Item\Archive\ArchiveRequestBuilderPostRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new ArchiveRequestBuilderPostRequestConfiguration();
$headers = [
'Prefer' => 'respond-async',
];
$requestConfiguration->headers = $headers;
$graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->archive()->post($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Files
Invoke-MgBetaArchiveDriveItem -DriveId $driveId -DriveItemId $driveItemId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.drives.item.items.item.archive.archive_request_builder import ArchiveRequestBuilder
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", "respond-async")
await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').archive.post(request_configuration = request_configuration)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/monitor/4A3407B5-88FC-4504-8B21-0AABD3412717