oneDriveForBusinessRestoreSession を作成する
[アーティクル]
08/22/2024
1 人の共同作成者
フィードバック
この記事の内容
名前空間: microsoft.graph
新しい oneDriveForBusinessRestoreSession オブジェクトを 作成します。
この API は、次の国内クラウド展開 で使用できます。
グローバル サービス
米国政府機関 L4
米国政府機関 L5 (DOD)
21Vianet が運営する中国
✅
❌
❌
❌
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ 、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類 」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス 」を参照してください。
アクセス許可の種類
最小特権アクセス許可
より高い特権のアクセス許可
委任 (職場または学校のアカウント)
BackupRestore-Restore.ReadWrite.All
注意事項なし。
委任 (個人用 Microsoft アカウント)
サポートされていません。
サポートされていません。
アプリケーション
BackupRestore-Restore.ReadWrite.All
注意事項なし。
HTTP 要求
POST /solutions/backupRestore/oneDriveForBusinessRestoreSessions
名前
説明
Authorization
ベアラー {token}。 必須です。
認証と認可 についての詳細をご覧ください。
Content-Type
application/json. 必須です。
要求本文
要求本文で、 oneDriveForBusinessRestoreSession オブジェクトの JSON 表現を指定します。
oneDriveForBusinessRestoreSession を作成するときに、次のプロパティを指定できます。
応答
成功した場合、このメソッドは 201 Created
応答コードと、応答本文に oneDriveForBusinessRestoreSession オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/v1.0/solutions/backupRestore/oneDriveForBusinessRestoreSessions
Content-Type: application/json
{
"driveRestoreArtifacts": [
{
"restorePoint": { "@odata.id": "1f1fccc3-a642-4f61-bf49-f37b9a888279" },
"destinationType": "new"
},
{
"restorePoint": { "@odata.id": "1f1fccc3-a642-4f61-bf49-f37b9a888280" },
"destinationType": "new"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new OneDriveForBusinessRestoreSession
{
DriveRestoreArtifacts = new List<DriveRestoreArtifact>
{
new DriveRestoreArtifact
{
RestorePoint = new RestorePoint
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.id" , "1f1fccc3-a642-4f61-bf49-f37b9a888279"
},
},
},
DestinationType = DestinationType.New,
},
new DriveRestoreArtifact
{
RestorePoint = new RestorePoint
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.id" , "1f1fccc3-a642-4f61-bf49-f37b9a888280"
},
},
},
DestinationType = DestinationType.New,
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.OneDriveForBusinessRestoreSessions.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc solutions backup-restore one-drive-for-business-restore-sessions create --body '{\
"driveRestoreArtifacts": [\
{\
"restorePoint": { "@odata.id": "1f1fccc3-a642-4f61-bf49-f37b9a888279" },\
"destinationType": "new"\
},\
{\
"restorePoint": { "@odata.id": "1f1fccc3-a642-4f61-bf49-f37b9a888280" },\
"destinationType": "new"\
}\
]\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewOneDriveForBusinessRestoreSession()
driveRestoreArtifact := graphmodels.NewDriveRestoreArtifact()
restorePoint := graphmodels.NewRestorePoint()
additionalData := map[string]interface{}{
"@odata.id" : "1f1fccc3-a642-4f61-bf49-f37b9a888279",
}
restorePoint.SetAdditionalData(additionalData)
driveRestoreArtifact.SetRestorePoint(restorePoint)
destinationType := graphmodels.NEW_DESTINATIONTYPE
driveRestoreArtifact.SetDestinationType(&destinationType)
driveRestoreArtifact1 := graphmodels.NewDriveRestoreArtifact()
restorePoint := graphmodels.NewRestorePoint()
additionalData := map[string]interface{}{
"@odata.id" : "1f1fccc3-a642-4f61-bf49-f37b9a888280",
}
restorePoint.SetAdditionalData(additionalData)
driveRestoreArtifact1.SetRestorePoint(restorePoint)
destinationType := graphmodels.NEW_DESTINATIONTYPE
driveRestoreArtifact1.SetDestinationType(&destinationType)
driveRestoreArtifacts := []graphmodels.DriveRestoreArtifactable {
driveRestoreArtifact,
driveRestoreArtifact1,
}
requestBody.SetDriveRestoreArtifacts(driveRestoreArtifacts)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
oneDriveForBusinessRestoreSessions, err := graphClient.Solutions().BackupRestore().OneDriveForBusinessRestoreSessions().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);
OneDriveForBusinessRestoreSession oneDriveForBusinessRestoreSession = new OneDriveForBusinessRestoreSession();
LinkedList<DriveRestoreArtifact> driveRestoreArtifacts = new LinkedList<DriveRestoreArtifact>();
DriveRestoreArtifact driveRestoreArtifact = new DriveRestoreArtifact();
RestorePoint restorePoint = new RestorePoint();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("@odata.id", "1f1fccc3-a642-4f61-bf49-f37b9a888279");
restorePoint.setAdditionalData(additionalData);
driveRestoreArtifact.setRestorePoint(restorePoint);
driveRestoreArtifact.setDestinationType(DestinationType.New);
driveRestoreArtifacts.add(driveRestoreArtifact);
DriveRestoreArtifact driveRestoreArtifact1 = new DriveRestoreArtifact();
RestorePoint restorePoint1 = new RestorePoint();
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("@odata.id", "1f1fccc3-a642-4f61-bf49-f37b9a888280");
restorePoint1.setAdditionalData(additionalData1);
driveRestoreArtifact1.setRestorePoint(restorePoint1);
driveRestoreArtifact1.setDestinationType(DestinationType.New);
driveRestoreArtifacts.add(driveRestoreArtifact1);
oneDriveForBusinessRestoreSession.setDriveRestoreArtifacts(driveRestoreArtifacts);
OneDriveForBusinessRestoreSession result = graphClient.solutions().backupRestore().oneDriveForBusinessRestoreSessions().post(oneDriveForBusinessRestoreSession);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const oneDriveForBusinessRestoreSession = {
driveRestoreArtifacts: [
{
restorePoint: { '@odata.id': '1f1fccc3-a642-4f61-bf49-f37b9a888279' },
destinationType: 'new'
},
{
restorePoint: { '@odata.id': '1f1fccc3-a642-4f61-bf49-f37b9a888280' },
destinationType: 'new'
}
]
};
await client.api('/solutions/backupRestore/oneDriveForBusinessRestoreSessions')
.post(oneDriveForBusinessRestoreSession);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\OneDriveForBusinessRestoreSession;
use Microsoft\Graph\Generated\Models\DriveRestoreArtifact;
use Microsoft\Graph\Generated\Models\RestorePoint;
use Microsoft\Graph\Generated\Models\DestinationType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OneDriveForBusinessRestoreSession();
$driveRestoreArtifactsDriveRestoreArtifact1 = new DriveRestoreArtifact();
$driveRestoreArtifactsDriveRestoreArtifact1RestorePoint = new RestorePoint();
$additionalData = [
'@odata.id' => '1f1fccc3-a642-4f61-bf49-f37b9a888279',
];
$driveRestoreArtifactsDriveRestoreArtifact1RestorePoint->setAdditionalData($additionalData);
$driveRestoreArtifactsDriveRestoreArtifact1->setRestorePoint($driveRestoreArtifactsDriveRestoreArtifact1RestorePoint);
$driveRestoreArtifactsDriveRestoreArtifact1->setDestinationType(new DestinationType('new'));
$driveRestoreArtifactsArray []= $driveRestoreArtifactsDriveRestoreArtifact1;
$driveRestoreArtifactsDriveRestoreArtifact2 = new DriveRestoreArtifact();
$driveRestoreArtifactsDriveRestoreArtifact2RestorePoint = new RestorePoint();
$additionalData = [
'@odata.id' => '1f1fccc3-a642-4f61-bf49-f37b9a888280',
];
$driveRestoreArtifactsDriveRestoreArtifact2RestorePoint->setAdditionalData($additionalData);
$driveRestoreArtifactsDriveRestoreArtifact2->setRestorePoint($driveRestoreArtifactsDriveRestoreArtifact2RestorePoint);
$driveRestoreArtifactsDriveRestoreArtifact2->setDestinationType(new DestinationType('new'));
$driveRestoreArtifactsArray []= $driveRestoreArtifactsDriveRestoreArtifact2;
$requestBody->setDriveRestoreArtifacts($driveRestoreArtifactsArray);
$result = $graphServiceClient->solutions()->backupRestore()->oneDriveForBusinessRestoreSessions()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.models.one_drive_for_business_restore_session import OneDriveForBusinessRestoreSession
from msgraph.generated.models.drive_restore_artifact import DriveRestoreArtifact
from msgraph.generated.models.restore_point import RestorePoint
from msgraph.generated.models.destination_type import DestinationType
graph_client = GraphServiceClient(credentials, scopes)
request_body = OneDriveForBusinessRestoreSession(
drive_restore_artifacts = [
DriveRestoreArtifact(
restore_point = RestorePoint(
additional_data = {
"@odata_id" : "1f1fccc3-a642-4f61-bf49-f37b9a888279",
}
),
destination_type = DestinationType.New,
),
DriveRestoreArtifact(
restore_point = RestorePoint(
additional_data = {
"@odata_id" : "1f1fccc3-a642-4f61-bf49-f37b9a888280",
}
),
destination_type = DestinationType.New,
),
],
)
result = await graph_client.solutions.backup_restore.one_drive_for_business_restore_sessions.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "/solutions/backupRestore/$metadata#oneDriveForBusinessRestoreSession/$entity",
"id": "959ba739-70b5-43c4-8c90-b2c22014f18b",
"status": "draft",
"createdBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
"displayName": "Microsoft Enhanced Restore"
},
"user": {
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User1"
}
},
"createdDateTime": "2023-03-30T12:01:03.45Z",
"lastModifiedBy": {
"application": {
"id": "1fec8e78-bce4-4aaf-ab1b-5451cc387264",
"displayName": "Microsoft Enhanced Restore"
},
"user": {
"id": "845457dc-4bb2-4815-bef3-8628ebd1952e",
"displayName": "User2"
}
},
"lastModifiedDateTime": "2023-03-30T12:01:03.45Z"
}