Пространство имен: microsoft.graph
Важно!
API версии /beta в Microsoft Graph могут быть изменены. Использование этих API в производственных приложениях не поддерживается. Чтобы определить, доступен ли API в версии 1.0, используйте селектор версий.
Создайте объект mailboxRestoreArtifactsBulkAdditionRequest , связанный с exchangeRestoreSession.
Ниже описано, как создать exchangeRestoreSession и управлять им с помощью массового добавления артефактов.
- Создайте exchangeRestoreSession с пустыми полезными данными .
- Создайте объект mailboxRestoreArtifactsBulkAdditionRequest , связанный с exchangeRestoreSession.
- Получите состояние mailboxRestoreArtifactsBulkAdditionRequest для сеанса восстановления Exchange. Начальное состояние при создании равно
active и остается в этом состоянии до активации exchangeRestoreSession .
- Активируйте exchangeRestoreSession , созданное на первом шаге.
- Отслеживайте состояние mailboxRestoreArtifactsBulkAdditionRequest. Когда все сообщения электронной почты добавляются в соответствующую exchangeRestoreSession, состояние mailboxRestoreArtifactsBulkAdditionRequest изменяется на
completed. Если при разрешении ресурсов возникают сбои, состояние изменяется на completedWithErrors.
Этот API доступен в следующих национальных облачных развертываниях.
| Глобальная служба |
Правительство США L4 |
Правительство США L5 (DOD) |
Китай управляется 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Разрешения
Выберите разрешение или разрешения, помеченные как наименее привилегированные для этого API. Используйте более привилегированное разрешение или разрешения только в том случае, если это требуется приложению. Дополнительные сведения о делегированных разрешениях и разрешениях приложений см. в разделе Типы разрешений. Дополнительные сведения об этих разрешениях см. в справочнике по разрешениям.
| Тип разрешения |
Разрешение с наименьшими привилегиями |
Более высокие привилегированные разрешения |
| Делегированные (рабочая или учебная учетная запись) |
BackupRestore-Restore.ReadWrite.All |
Недоступно. |
| Делегированные (личная учетная запись Майкрософт) |
Не поддерживается. |
Не поддерживается. |
| Приложение |
BackupRestore-Restore.ReadWrite.All |
Недоступно. |
HTTP-запрос
POST /solutions/backupRestore/exchangeRestoreSessions/{exchangeRestoreSessionId}/mailboxRestoreArtifactsBulkAdditionRequests
Текст запроса
В тексте запроса укажите представление объекта mailboxRestoreArtifactsBulkAdditionRequest в формате JSON.
При создании объекта mailboxRestoreArtifactsBulkAdditionRequest можно указать следующие свойства.
| Свойство |
Тип |
Описание |
| directoryObjectIds |
Коллекция строк |
Список идентификаторов объектов каталога. Необязательный параметр. |
| Почтовых ящиков |
Коллекция строк |
Список адресов электронной почты. Необязательный параметр. |
Отклик
В случае успешного выполнения этот метод возвращает код отклика 201 Created и объект mailboxRestoreArtifactsBulkAdditionRequest в теле отклика.
Список возможных ответов на ошибки см. в разделе Ответы на ошибки API хранилища резервных копий.
Примеры
Запрос
В следующем примере показан запрос, который добавляет список почтовых ящиков в указанный сеанс восстановления Exchange в ходе массовой операции.
POST https://graph.microsoft.com/beta/solutions/backupRestore/exchangeRestoreSessions/dc3a3fc8-eb4b-45eb-9ca6-4955696344b8/mailboxRestoreArtifactsBulkAdditionRequests
Content-Type: application/json
{
"displayName": "Usermailbox-BulkRestoreArtifacts",
"mailboxes": [
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com"
],
"protectionTimePeriod": {
"startDateTime": "2021-01-01T00:00:00Z",
"endDateTime": "2021-01-08T00:00:00Z"
},
"destinationType": "new",
"tags": "fastRestore",
"restorePointPreference": "latest"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new MailboxRestoreArtifactsBulkAdditionRequest
{
DisplayName = "Usermailbox-BulkRestoreArtifacts",
Mailboxes = new List<string>
{
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com",
},
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.ExchangeRestoreSessions["{exchangeRestoreSession-id}"].MailboxRestoreArtifactsBulkAdditionRequests.PostAsync(requestBody);
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewMailboxRestoreArtifactsBulkAdditionRequest()
displayName := "Usermailbox-BulkRestoreArtifacts"
requestBody.SetDisplayName(&displayName)
mailboxes := []string {
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com",
}
requestBody.SetMailboxes(mailboxes)
protectionTimePeriod := graphmodels.NewTimePeriod()
startDateTime , err := time.Parse(time.RFC3339, "2021-01-01T00:00:00Z")
protectionTimePeriod.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2021-01-08T00:00:00Z")
protectionTimePeriod.SetEndDateTime(&endDateTime)
requestBody.SetProtectionTimePeriod(protectionTimePeriod)
destinationType := graphmodels.NEW_DESTINATIONTYPE
requestBody.SetDestinationType(&destinationType)
tags := graphmodels.FASTRESTORE_RESTOREPOINTTAGS
requestBody.SetTags(&tags)
restorePointPreference := graphmodels.LATEST_RESTOREPOINTPREFERENCE
requestBody.SetRestorePointPreference(&restorePointPreference)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
mailboxRestoreArtifactsBulkAdditionRequests, err := graphClient.Solutions().BackupRestore().ExchangeRestoreSessions().ByExchangeRestoreSessionId("exchangeRestoreSession-id").MailboxRestoreArtifactsBulkAdditionRequests().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MailboxRestoreArtifactsBulkAdditionRequest mailboxRestoreArtifactsBulkAdditionRequest = new MailboxRestoreArtifactsBulkAdditionRequest();
mailboxRestoreArtifactsBulkAdditionRequest.setDisplayName("Usermailbox-BulkRestoreArtifacts");
LinkedList<String> mailboxes = new LinkedList<String>();
mailboxes.add("contoso1@micorosft.com");
mailboxes.add("consotos2@microsoft.com");
mailboxes.add("contoso3@microsoft.com");
mailboxRestoreArtifactsBulkAdditionRequest.setMailboxes(mailboxes);
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);
mailboxRestoreArtifactsBulkAdditionRequest.setProtectionTimePeriod(protectionTimePeriod);
mailboxRestoreArtifactsBulkAdditionRequest.setDestinationType(DestinationType.New);
mailboxRestoreArtifactsBulkAdditionRequest.setTags(EnumSet.of(RestorePointTags.FastRestore));
mailboxRestoreArtifactsBulkAdditionRequest.setRestorePointPreference(RestorePointPreference.Latest);
MailboxRestoreArtifactsBulkAdditionRequest result = graphClient.solutions().backupRestore().exchangeRestoreSessions().byExchangeRestoreSessionId("{exchangeRestoreSession-id}").mailboxRestoreArtifactsBulkAdditionRequests().post(mailboxRestoreArtifactsBulkAdditionRequest);
const options = {
authProvider,
};
const client = Client.init(options);
const mailboxRestoreArtifactsBulkAdditionRequest = {
displayName: 'Usermailbox-BulkRestoreArtifacts',
mailboxes: [
'contoso1@micorosft.com',
'consotos2@microsoft.com',
'contoso3@microsoft.com'
],
protectionTimePeriod: {
startDateTime: '2021-01-01T00:00:00Z',
endDateTime: '2021-01-08T00:00:00Z'
},
destinationType: 'new',
tags: 'fastRestore',
restorePointPreference: 'latest'
};
await client.api('/solutions/backupRestore/exchangeRestoreSessions/dc3a3fc8-eb4b-45eb-9ca6-4955696344b8/mailboxRestoreArtifactsBulkAdditionRequests')
.version('beta')
.post(mailboxRestoreArtifactsBulkAdditionRequest);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\MailboxRestoreArtifactsBulkAdditionRequest;
use Microsoft\Graph\Beta\Generated\Models\TimePeriod;
use Microsoft\Graph\Beta\Generated\Models\DestinationType;
use Microsoft\Graph\Beta\Generated\Models\RestorePointTags;
use Microsoft\Graph\Beta\Generated\Models\RestorePointPreference;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MailboxRestoreArtifactsBulkAdditionRequest();
$requestBody->setDisplayName('Usermailbox-BulkRestoreArtifacts');
$requestBody->setMailboxes(['contoso1@micorosft.com', 'consotos2@microsoft.com', 'contoso3@microsoft.com', ]);
$protectionTimePeriod = new TimePeriod();
$protectionTimePeriod->setStartDateTime(new \DateTime('2021-01-01T00:00:00Z'));
$protectionTimePeriod->setEndDateTime(new \DateTime('2021-01-08T00:00:00Z'));
$requestBody->setProtectionTimePeriod($protectionTimePeriod);
$requestBody->setDestinationType(new DestinationType('new'));
$requestBody->setTags(new RestorePointTags('fastRestore'));
$requestBody->setRestorePointPreference(new RestorePointPreference('latest'));
$result = $graphServiceClient->solutions()->backupRestore()->exchangeRestoreSessions()->byExchangeRestoreSessionId('exchangeRestoreSession-id')->mailboxRestoreArtifactsBulkAdditionRequests()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.BackupRestore
$params = @{
displayName = "Usermailbox-BulkRestoreArtifacts"
mailboxes = @(
"contoso1@micorosft.com"
"consotos2@microsoft.com"
"contoso3@microsoft.com"
)
protectionTimePeriod = @{
startDateTime = [System.DateTime]::Parse("2021-01-01T00:00:00Z")
endDateTime = [System.DateTime]::Parse("2021-01-08T00:00:00Z")
}
destinationType = "new"
tags = "fastRestore"
restorePointPreference = "latest"
}
New-MgBetaSolutionBackupRestoreExchangeRestoreSessionMailboxRestoreArtifactBulkAdditionRequest -ExchangeRestoreSessionId $exchangeRestoreSessionId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.mailbox_restore_artifacts_bulk_addition_request import MailboxRestoreArtifactsBulkAdditionRequest
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 = MailboxRestoreArtifactsBulkAdditionRequest(
display_name = "Usermailbox-BulkRestoreArtifacts",
mailboxes = [
"contoso1@micorosft.com",
"consotos2@microsoft.com",
"contoso3@microsoft.com",
],
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.exchange_restore_sessions.by_exchange_restore_session_id('exchangeRestoreSession-id').mailbox_restore_artifacts_bulk_addition_requests.post(request_body)
Отклик
Ниже приводится пример отклика.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "b4318e3a-3eae-4ce5-87f3-bad51e1527c4",
"destinationType": "new",
"tags": "fastRestore",
"restorePointPreference": "latest",
"displayName": "EXO-BulkRestoreArtifacts",
"status": "active",
"createdDateTime": "2024-12-03T13:17:19.8862272Z",
"lastModifiedDateTime": "2024-12-03T13:17:19.8862272Z",
"mailboxes": [],
"protectionTimePeriod": {
"startDateTime": "2024-11-26T00:00:00Z",
"endDateTime": "2024-12-03T00:00:00Z"
},
"createdBy": {
"user": {
"identity": "fb70be35-8c8e-4c8a-b55d-f8cd95c5e23a"
}
},
"lastModifiedBy": {
"user": {
"identity": "fb70be35-8c8e-4c8a-b55d-f8cd95c5e23a"
}
}
}