Пространство имен: microsoft.graph
Создайте объект siteRestoreArtifactsBulkAdditionRequest , связанный с sharePointRestoreSession.
Ниже описано, как создать sharePointRestoreSession и управлять им с помощью массового добавления артефактов.
- Создайте sharePointRestoreSession с пустыми полезными данными .
- Создайте объект siteRestoreArtifactsBulkAdditionRequest , связанный с sharePointRestoreSession.
- Получите состояние siteRestoreArtifactsBulkAdditionRequest для сеанса восстановления SharePoint. Начальное состояние при создании — и
active остается в этом состоянии до активации sharePointRestoreSession .
- Активируйте sharePointRestoreSession , созданное на первом шаге.
- Отслеживайте состояние siteRestoreArtifactsBulkAdditionRequest. При добавлении всех сайтов в соответствующий sharePointRestoreSession состояние siteRestoreArtifactsBulkAdditionRequest изменяется на
completed. Если при разрешении ресурсов возникают сбои, состояние изменяется на completedWithErrors.
Этот API доступен в следующих национальных облачных развертываниях.
| Глобальная служба |
Правительство США L4 |
Правительство США L5 (DOD) |
Китай управляется 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Разрешения
Выберите разрешение или разрешения, помеченные как наименее привилегированные для этого API. Используйте более привилегированное разрешение или разрешения только в том случае, если это требуется приложению. Дополнительные сведения о делегированных разрешениях и разрешениях приложений см. в разделе Типы разрешений. Дополнительные сведения об этих разрешениях см. в справочнике по разрешениям.
| Тип разрешения |
Разрешение с наименьшими привилегиями |
Более высокие привилегированные разрешения |
| Делегированные (рабочая или учебная учетная запись) |
BackupRestore-Restore.ReadWrite.All |
Недоступно. |
| Делегированные (личная учетная запись Майкрософт) |
Не поддерживается. |
Не поддерживается. |
| Приложение |
BackupRestore-Restore.ReadWrite.All |
Недоступно. |
HTTP-запрос
POST /solutions/backupRestore/sharePointRestoreSessions/{sharePointRestoreSessionId}/siteRestoreArtifactsBulkAdditionRequests
Текст запроса
В тексте запроса укажите представление объекта siteRestoreArtifactsBulkAdditionRequest в формате JSON.
При создании объекта siteRestoreArtifactsBulkAdditionRequest можно указать следующие свойства.
| Свойство |
Тип |
Описание |
| siteIds |
Коллекция строк |
Список идентификаторов сайтов SharePoint. Необязательный параметр. |
| siteWebUrls |
Коллекция строк |
Список URL-адресов сайтов SharePoint. Необязательный параметр. |
Отклик
В случае успешного выполнения этот метод возвращает код отклика 201 Created и объект siteRestoreArtifactsBulkAdditionRequest в тексте ответа.
Список возможных ответов на ошибки см. в разделе Ответы на ошибки API хранилища резервных копий.
Примеры
Запрос
В следующем примере показан запрос, который добавляет список сайтов в указанный сеанс восстановления SharePoint в ходе массовой операции.
POST https://graph.microsoft.com/v1.0/solutions/backupRestore/sharePointRestoreSessions/959ba739-70b5-43c4-8c90-b2c22014f18b/siteRestoreArtifactsBulkAdditionRequests
Content-Type: application/json
{
"displayName": "SPO-BulkRestoreArtifacts",
"siteWebUrls": [
"https: //contoso1.sharepoint.com",
"https: //contoso2.sharepoint.com",
"https: //contoso3.sharepoint.com"
],
"protectionTimePeriod": {
"startDateTime": "2024-01-01T00:00:00Z",
"endDateTime": "2024-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.Models;
var requestBody = new SiteRestoreArtifactsBulkAdditionRequest
{
DisplayName = "SPO-BulkRestoreArtifacts",
SiteWebUrls = new List<string>
{
"https: //contoso1.sharepoint.com",
"https: //contoso2.sharepoint.com",
"https: //contoso3.sharepoint.com",
},
ProtectionTimePeriod = new TimePeriod
{
StartDateTime = DateTimeOffset.Parse("2024-01-01T00:00:00Z"),
EndDateTime = DateTimeOffset.Parse("2024-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.SharePointRestoreSessions["{sharePointRestoreSession-id}"].SiteRestoreArtifactsBulkAdditionRequests.PostAsync(requestBody);
Подробнее о том, как добавить 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.NewSiteRestoreArtifactsBulkAdditionRequest()
displayName := "SPO-BulkRestoreArtifacts"
requestBody.SetDisplayName(&displayName)
siteWebUrls := []string {
"https: //contoso1.sharepoint.com",
"https: //contoso2.sharepoint.com",
"https: //contoso3.sharepoint.com",
}
requestBody.SetSiteWebUrls(siteWebUrls)
protectionTimePeriod := graphmodels.NewTimePeriod()
startDateTime , err := time.Parse(time.RFC3339, "2024-01-01T00:00:00Z")
protectionTimePeriod.SetStartDateTime(&startDateTime)
endDateTime , err := time.Parse(time.RFC3339, "2024-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
siteRestoreArtifactsBulkAdditionRequests, err := graphClient.Solutions().BackupRestore().SharePointRestoreSessions().BySharePointRestoreSessionId("sharePointRestoreSession-id").SiteRestoreArtifactsBulkAdditionRequests().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);
SiteRestoreArtifactsBulkAdditionRequest siteRestoreArtifactsBulkAdditionRequest = new SiteRestoreArtifactsBulkAdditionRequest();
siteRestoreArtifactsBulkAdditionRequest.setDisplayName("SPO-BulkRestoreArtifacts");
LinkedList<String> siteWebUrls = new LinkedList<String>();
siteWebUrls.add("https: //contoso1.sharepoint.com");
siteWebUrls.add("https: //contoso2.sharepoint.com");
siteWebUrls.add("https: //contoso3.sharepoint.com");
siteRestoreArtifactsBulkAdditionRequest.setSiteWebUrls(siteWebUrls);
TimePeriod protectionTimePeriod = new TimePeriod();
OffsetDateTime startDateTime = OffsetDateTime.parse("2024-01-01T00:00:00Z");
protectionTimePeriod.setStartDateTime(startDateTime);
OffsetDateTime endDateTime = OffsetDateTime.parse("2024-01-08T00:00:00Z");
protectionTimePeriod.setEndDateTime(endDateTime);
siteRestoreArtifactsBulkAdditionRequest.setProtectionTimePeriod(protectionTimePeriod);
siteRestoreArtifactsBulkAdditionRequest.setDestinationType(DestinationType.New);
siteRestoreArtifactsBulkAdditionRequest.setTags(EnumSet.of(RestorePointTags.FastRestore));
siteRestoreArtifactsBulkAdditionRequest.setRestorePointPreference(RestorePointPreference.Latest);
SiteRestoreArtifactsBulkAdditionRequest result = graphClient.solutions().backupRestore().sharePointRestoreSessions().bySharePointRestoreSessionId("{sharePointRestoreSession-id}").siteRestoreArtifactsBulkAdditionRequests().post(siteRestoreArtifactsBulkAdditionRequest);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
const options = {
authProvider,
};
const client = Client.init(options);
const siteRestoreArtifactsBulkAdditionRequest = {
displayName: 'SPO-BulkRestoreArtifacts',
siteWebUrls: [
'https: //contoso1.sharepoint.com',
'https: //contoso2.sharepoint.com',
'https: //contoso3.sharepoint.com'
],
protectionTimePeriod: {
startDateTime: '2024-01-01T00:00:00Z',
endDateTime: '2024-01-08T00:00:00Z'
},
destinationType: 'new',
tags: 'fastRestore',
restorePointPreference: 'latest'
};
await client.api('/solutions/backupRestore/sharePointRestoreSessions/959ba739-70b5-43c4-8c90-b2c22014f18b/siteRestoreArtifactsBulkAdditionRequests')
.post(siteRestoreArtifactsBulkAdditionRequest);
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\SiteRestoreArtifactsBulkAdditionRequest;
use Microsoft\Graph\Generated\Models\TimePeriod;
use Microsoft\Graph\Generated\Models\DestinationType;
use Microsoft\Graph\Generated\Models\RestorePointTags;
use Microsoft\Graph\Generated\Models\RestorePointPreference;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new SiteRestoreArtifactsBulkAdditionRequest();
$requestBody->setDisplayName('SPO-BulkRestoreArtifacts');
$requestBody->setSiteWebUrls(['https: //contoso1.sharepoint.com', 'https: //contoso2.sharepoint.com', 'https: //contoso3.sharepoint.com', ]);
$protectionTimePeriod = new TimePeriod();
$protectionTimePeriod->setStartDateTime(new \DateTime('2024-01-01T00:00:00Z'));
$protectionTimePeriod->setEndDateTime(new \DateTime('2024-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()->sharePointRestoreSessions()->bySharePointRestoreSessionId('sharePointRestoreSession-id')->siteRestoreArtifactsBulkAdditionRequests()->post($requestBody)->wait();
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
Import-Module Microsoft.Graph.BackupRestore
$params = @{
displayName = "SPO-BulkRestoreArtifacts"
siteWebUrls = @(
"https: //contoso1.sharepoint.com"
"https: //contoso2.sharepoint.com"
"https: //contoso3.sharepoint.com"
)
protectionTimePeriod = @{
startDateTime = [System.DateTime]::Parse("2024-01-01T00:00:00Z")
endDateTime = [System.DateTime]::Parse("2024-01-08T00:00:00Z")
}
destinationType = "new"
tags = "fastRestore"
restorePointPreference = "latest"
}
New-MgSolutionBackupRestoreSharePointRestoreSessionSiteRestoreArtifactBulkAdditionRequest -SharePointRestoreSessionId $sharePointRestoreSessionId -BodyParameter $params
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.site_restore_artifacts_bulk_addition_request import SiteRestoreArtifactsBulkAdditionRequest
from msgraph.generated.models.time_period import TimePeriod
from msgraph.generated.models.destination_type import DestinationType
from msgraph.generated.models.restore_point_tags import RestorePointTags
from msgraph.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 = SiteRestoreArtifactsBulkAdditionRequest(
display_name = "SPO-BulkRestoreArtifacts",
site_web_urls = [
"https: //contoso1.sharepoint.com",
"https: //contoso2.sharepoint.com",
"https: //contoso3.sharepoint.com",
],
protection_time_period = TimePeriod(
start_date_time = "2024-01-01T00:00:00Z",
end_date_time = "2024-01-08T00:00:00Z",
),
destination_type = DestinationType.New,
tags = RestorePointTags.FastRestore,
restore_point_preference = RestorePointPreference.Latest,
)
result = await graph_client.solutions.backup_restore.share_point_restore_sessions.by_share_point_restore_session_id('sharePointRestoreSession-id').site_restore_artifacts_bulk_addition_requests.post(request_body)
Подробнее о том, как добавить SDK в свой проект и создать экземпляр authProvider, см. в документации по SDK.
Отклик
Ниже приводится пример отклика.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "/solutions/backupRestore/$metadata#siteRestoreArtifactsBulkAdditionRequest/$entity",
"id": "4437afcf-e520-463c-90a7-ca96401d8039",
"destinationType": "new",
"tags": "fastRestore",
"restorePointPreference": "latest",
"displayName": "SPO-BulkRestoreArtifacts",
"status": "active",
"createdDateTime": "2024-12-03T07:47:57.6011358Z",
"lastModifiedDateTime": "2024-12-03T07:47:57.6011358Z",
"siteWebUrls": [],
"protectionTimePeriod": {
"startDateTime": "2024-01-01T00:00:00Z",
"endDateTime": "2024-01-08T00:00:00Z"
},
"createdBy": {
"user": {
"identity": "fb70be35-8c8e-4c8a-b55d-f8cd95c5e23a"
}
},
"lastModifiedBy": {
"user": {
"identity": "fb70be35-8c8e-4c8a-b55d-f8cd95c5e23a"
}
}
}