Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
La status initiale lors de la création de la session de restauration est active. Lorsque tous les lecteurs sont ajoutés à la session de restauration OneDrive correspondante et que la session de restauration est activée, le status devient completed. Si des échecs sont rencontrés lors de la résolution des ressources, le status de la session de restauration devient completedWithErrors.
L’exemple suivant montre une requête qui ajoute une liste de lecteurs à la session onedrive pour la restauration professionnelle ou scolaire spécifiée dans une opération en bloc.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new DriveRestoreArtifactsBulkAdditionRequest
{
DisplayName = "ODB-BulkRestoreArtifacts",
Drives = new List<string>
{
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com",
},
DirectoryObjectIds = new List<string>
{
},
ProtectionUnitIds = new List<string>
{
},
ProtectionTimePeriod = new TimePeriod
{
StartDateTime = DateTimeOffset.Parse("2021-01-01T00:00:00Z"),
EndDateTime = DateTimeOffset.Parse("2021-01-08T00:00:00Z"),
},
DestinationType = DestinationType.New,
Tags = RestorePointTags.FastRestore,
RestorePointPreference = RestorePointPreference.Latest,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BackupRestore.OneDriveForBusinessRestoreSessions["{oneDriveForBusinessRestoreSession-id}"].DriveRestoreArtifactsBulkAdditionRequests.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DriveRestoreArtifactsBulkAdditionRequest driveRestoreArtifactsBulkAdditionRequest = new DriveRestoreArtifactsBulkAdditionRequest();
driveRestoreArtifactsBulkAdditionRequest.setDisplayName("ODB-BulkRestoreArtifacts");
LinkedList<String> drives = new LinkedList<String>();
drives.add("contoso1@micorosft.com");
drives.add("consotos2@microsoft.com");
drives.add("contoso3@microsoft.com");
driveRestoreArtifactsBulkAdditionRequest.setDrives(drives);
LinkedList<String> directoryObjectIds = new LinkedList<String>();
driveRestoreArtifactsBulkAdditionRequest.setDirectoryObjectIds(directoryObjectIds);
LinkedList<String> protectionUnitIds = new LinkedList<String>();
driveRestoreArtifactsBulkAdditionRequest.setProtectionUnitIds(protectionUnitIds);
TimePeriod protectionTimePeriod = new TimePeriod();
OffsetDateTime startDateTime = OffsetDateTime.parse("2021-01-01T00:00:00Z");
protectionTimePeriod.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2021-01-08T00:00:00Z");
protectionTimePeriod.setEndDateTime(endDateTime);
driveRestoreArtifactsBulkAdditionRequest.setProtectionTimePeriod(protectionTimePeriod);
driveRestoreArtifactsBulkAdditionRequest.setDestinationType(DestinationType.New);
driveRestoreArtifactsBulkAdditionRequest.setTags(EnumSet.of(RestorePointTags.FastRestore));
driveRestoreArtifactsBulkAdditionRequest.setRestorePointPreference(RestorePointPreference.Latest);
DriveRestoreArtifactsBulkAdditionRequest result = graphClient.solutions().backupRestore().oneDriveForBusinessRestoreSessions().byOneDriveForBusinessRestoreSessionId("{oneDriveForBusinessRestoreSession-id}").driveRestoreArtifactsBulkAdditionRequests().post(driveRestoreArtifactsBulkAdditionRequest);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.drive_restore_artifacts_bulk_addition_request import DriveRestoreArtifactsBulkAdditionRequest
from msgraph_beta.generated.models.time_period import TimePeriod
from msgraph_beta.generated.models.destination_type import DestinationType
from msgraph_beta.generated.models.restore_point_tags import RestorePointTags
from msgraph_beta.generated.models.restore_point_preference import RestorePointPreference
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = DriveRestoreArtifactsBulkAdditionRequest(
display_name = "ODB-BulkRestoreArtifacts",
drives = [
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com",
],
directory_object_ids = [
],
protection_unit_ids = [
],
protection_time_period = TimePeriod(
start_date_time = "2021-01-01T00:00:00Z",
end_date_time = "2021-01-08T00:00:00Z",
),
destination_type = DestinationType.New,
tags = RestorePointTags.FastRestore,
restore_point_preference = RestorePointPreference.Latest,
)
result = await graph_client.solutions.backup_restore.one_drive_for_business_restore_sessions.by_one_drive_for_business_restore_session_id('oneDriveForBusinessRestoreSession-id').drive_restore_artifacts_bulk_addition_requests.post(request_body)