Restore deleted item (directory object)
Namespace: microsoft.graph
Restore a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items. If an item was accidentally deleted, you can fully restore the item. This is not applicable to security groups, which are deleted permanently.
A recently deleted item will remain available for up to 30 days. After 30 days, the item is permanently deleted.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
For applications and service principals:
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Application.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | Application.ReadWrite.OwnedBy, Application.ReadWrite.All |
The calling app must be assigned one of the following Azure AD roles:
- Global Administrator
- Application Administrator
- Cloud Application Administrator
- Hybrid Identity Administrator
For users:
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | User.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | User.ReadWrite.All |
For groups:
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Group.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | Group.ReadWrite.All |
For administrative units:
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | AdministrativeUnit.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | AdministrativeUnit.ReadWrite.All |
HTTP request
POST /directory/deletedItems/{id}/restore
Request headers
Name | Description |
---|---|
Authorization | Bearer <token> Required |
Content-type | application/json |
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a directoryObject object in the response body.
Example
Request
POST https://graph.microsoft.com/v1.0/directory/deletedItems/{object-id}/restore
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#directoryObjects/$entity",
"@odata.type":"#microsoft.graph.group",
"id":"46cc6179-19d0-473e-97ad-6ff84347bbbb",
"displayName":"SampleGroup",
"groupTypes":["Unified"],
"mail":"example@contoso.com",
"mailEnabled":true,
"mailNickname":"Example",
"securityEnabled":false,
"visibility":"Public"
}
Feedback
Submit and view feedback for