// 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)