managedDevice: restoreCloudPc
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta
API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
将云电脑设备从快照还原到以前的状态。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
CloudPC.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
CloudPC.ReadWrite.All
HTTP 请求
POST /deviceManagement/managedDevices/{managedDeviceId}/restoreCloudPc
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json. Required.
请求正文
在请求正文中,提供参数的 JSON 表示形式。
下表显示了可用于此操作的参数。
参数
类型
说明
cloudPcSnapshotId
字符串
特定时间点云电脑设备快照的唯一标识符。
响应
如果成功,此操作返回 204 No Content
响应代码。
示例
请求
请求示例如下所示。
POST https://graph.microsoft.com/beta/deviceManagement/managedDevices/5e1387aa-d960-4916-ae7c-293b977e49bf/restoreCloudPc
Content-Type: application/json
Content-length: 37
{
"cloudPcSnapshotId": "A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var cloudPcSnapshotId = "A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8";
await graphClient.DeviceManagement.ManagedDevices["{managedDevice-id}"]
.RestoreCloudPc(cloudPcSnapshotId)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const restoreCloudPc = {
cloudPcSnapshotId: 'A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8'
};
await client.api('/deviceManagement/managedDevices/5e1387aa-d960-4916-ae7c-293b977e49bf/restoreCloudPc')
.version('beta')
.post(restoreCloudPc);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/deviceManagement/managedDevices/5e1387aa-d960-4916-ae7c-293b977e49bf/restoreCloudPc"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *cloudPcSnapshotId = @"A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8";
payloadDictionary[@"cloudPcSnapshotId"] = cloudPcSnapshotId;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
String cloudPcSnapshotId = "A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8";
graphClient.deviceManagement().managedDevices("5e1387aa-d960-4916-ae7c-293b977e49bf")
.restoreCloudPc(ManagedDeviceRestoreCloudPcParameterSet
.newBuilder()
.withCloudPcSnapshotId(cloudPcSnapshotId)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewCloudPcSnapshotIdRequestBody()
cloudPcSnapshotId := "A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8"
requestBody.SetCloudPcSnapshotId(&cloudPcSnapshotId)
managedDeviceId := "managedDevice-id"
graphClient.DeviceManagement().ManagedDevicesById(&managedDeviceId).RestoreCloudPc(managedDevice-id).Post(requestBody)
Import-Module Microsoft.Graph.DeviceManagement.Actions
$params = @{
CloudPcSnapshotId = "A00009UV000_93aff428-61f2-467f-a879-1102af6fd4a8"
}
Restore-MgDeviceManagementManagedDeviceCloudPc -ManagedDeviceId $managedDeviceId -BodyParameter $params
响应
下面展示了示例响应。
HTTP/1.1 204 No Content