Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Restore recycleBinItem objects from the recycleBin of a fileStorageContainer.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permission |
Higher privileged permissions |
Delegated (work or school account) |
FileStorageContainer.Selected |
Not supported. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
FileStorageContainer.Selected |
Not supported. |
Note
In addition to Microsoft Graph permissions, your app must have the necessary container type-level permission or permissions to call this API. For more information, see container types. To learn more about container type-level permissions, see SharePoint Embedded authorization.
HTTP request
POST /storage/fileStorage/containers/{containerId}/recycleBin/items/restore
Request body
In the request body, supply a JSON representation of the parameters.
The following table shows the parameters that you can use with this action.
Parameter |
Type |
Description |
ids |
String collection |
The IDs of the recycleBinItem objects to restore. Required. |
Response
If successful, this method returns a 207 Multi-Status
response code and the set of restored recycleBinItem objects in the response body.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/recycleBin/items/restore
Content-Type: application/json
{
"ids": ["5d625d33-338c-4a77-a98a-3e287116440c", "73133853-48f2-4956-bc4a-03f8d1675042"]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Storage.FileStorage.Containers.Item.RecycleBin.Items.Restore;
var requestBody = new RestorePostRequestBody
{
Ids = new List<string>
{
"5d625d33-338c-4a77-a98a-3e287116440c",
"73133853-48f2-4956-bc4a-03f8d1675042",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Storage.FileStorage.Containers["{fileStorageContainer-id}"].RecycleBin.Items.Restore.PostAsRestorePostResponseAsync(requestBody);
mgc-beta storage file-storage containers recycle-bin items restore post --file-storage-container-id {fileStorageContainer-id} --body '{\
"ids": ["5d625d33-338c-4a77-a98a-3e287116440c", "73133853-48f2-4956-bc4a-03f8d1675042"]\
}\
'
// 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"
graphstorage "github.com/microsoftgraph/msgraph-beta-sdk-go/storage"
//other-imports
)
requestBody := graphstorage.NewRestorePostRequestBody()
ids := []string {
"5d625d33-338c-4a77-a98a-3e287116440c",
"73133853-48f2-4956-bc4a-03f8d1675042",
}
requestBody.SetIds(ids)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
restore, err := graphClient.Storage().FileStorage().Containers().ByFileStorageContainerId("fileStorageContainer-id").RecycleBin().Items().Restore().PostAsRestorePostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.storage.filestorage.containers.item.recyclebin.items.restore.RestorePostRequestBody restorePostRequestBody = new com.microsoft.graph.beta.storage.filestorage.containers.item.recyclebin.items.restore.RestorePostRequestBody();
LinkedList<String> ids = new LinkedList<String>();
ids.add("5d625d33-338c-4a77-a98a-3e287116440c");
ids.add("73133853-48f2-4956-bc4a-03f8d1675042");
restorePostRequestBody.setIds(ids);
var result = graphClient.storage().fileStorage().containers().byFileStorageContainerId("{fileStorageContainer-id}").recycleBin().items().restore().post(restorePostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const recycleBinItem = {
ids: ['5d625d33-338c-4a77-a98a-3e287116440c', '73133853-48f2-4956-bc4a-03f8d1675042']
};
await client.api('/storage/fileStorage/containers/b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z/recycleBin/items/restore')
.version('beta')
.post(recycleBinItem);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Storage\FileStorage\Containers\Item\RecycleBin\Items\Restore\RestorePostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new RestorePostRequestBody();
$requestBody->setIds(['5d625d33-338c-4a77-a98a-3e287116440c', '73133853-48f2-4956-bc4a-03f8d1675042', ]);
$result = $graphServiceClient->storage()->fileStorage()->containers()->byFileStorageContainerId('fileStorageContainer-id')->recycleBin()->items()->restore()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.storage.filestorage.containers.item.recyclebin.items.restore.restore_post_request_body import RestorePostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = RestorePostRequestBody(
ids = [
"5d625d33-338c-4a77-a98a-3e287116440c",
"73133853-48f2-4956-bc4a-03f8d1675042",
],
)
result = await graph_client.storage.file_storage.containers.by_file_storage_container_id('fileStorageContainer-id').recycle_bin.items.restore.post(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 207 Multi-Status
Content-Type: application/json
{
"value": [
{
"id": "5d625d33-338c-4a77-a98a-3e287116440c"
},
{
"id": "73133853-48f2-4956-bc4a-03f8d1675042"
}
]
}