Modifica

Condividi tramite


Get deleted item (directory object)

Namespace: microsoft.graph

Retrieve the properties of a recently deleted application, group, servicePrincipal, administrative unit, or user object from deleted items.

Retrieve the properties of a recently deleted directory object from deleted items. The following types are supported:

Note: Deleted security groups are deleted permanently and can't be retrieved through this API.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

The following table shows the least privileged permission or permissions required to call this API on each supported resource type. Follow best practices to request least privileged permissions. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Supported resource Delegated (work or school account) Delegated (personal Microsoft account) Application
administrativeUnit AdministrativeUnit.Read.All Not supported. AdministrativeUnit.Read.All
application Application.Read.All Not supported. Application.Read.All
certificateBasedAuthPki PublicKeyInfrastructure.Read.All Not supported. PublicKeyInfrastructure.Read.All
certificateAuthorityDetail PublicKeyInfrastructure.Read.All Not supported. PublicKeyInfrastructure.Read.All
group Group.Read.All Not supported. Group.Read.All
servicePrincipal Application.Read.All Not supported. Application.Read.All
user User.Read.All Not supported. User.Read.All

Important

In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. The following least privileged roles are supported for this operation.

  • Administrative units: Directory Readers (read-only), Global Readers (read-only), Privileged Role Administrator
  • Applications: Hybrid Identity Administrator, Cloud Application Administrator, Application Administrator
  • External user profiles: Global Reader (read-only), Skype for Business Administrator, Teams Administrator
  • Groups: Groups Administrator (except for role-assignable groups), User Administrator (except for role-assignable groups), Privileged Role Administrator (least privileged role for role-assignable groups)
  • Pending external user profiles: Global Reader (read-only), Skype for Business Administrator, Teams Administrator
  • Service principals: Hybrid Identity Administrator, Cloud Application Administrator, Application Administrator
  • Users: Authentication Administrator, Privileged Authentication Administrator, User Administrator. However, to restore users with privileged administrator roles:
    • In delegated scenarios, the app must be assigned the Directory.AccessAsUser.All delegated permission, and the calling user must also be assigned a higher privileged administrator role as indicated in Who can perform sensitive actions?.
    • In app-only scenarios and in addition to being granted the User.ReadWrite.All application permission, the app must be assigned a higher privileged administrator role as indicated in Who can perform sensitive actions?.

HTTP request

GET /directory/deletedItems/{object-id}

Optional query parameters

This method supports the OData Query Parameters to help customize the response.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Accept application/json

Request body

Don't 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

The following example shows a request.

GET https://graph.microsoft.com/v1.0/directory/deletedItems/{object-id}

Response

The following example shows the 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",
  "id":"46cc6179-19d0-473e-97ad-6ff84347bbbb",
  "displayName":"SampleGroup",
  "groupTypes":["Unified"],
  "mail":"[email protected]",
  "mailEnabled":true,
  "mailNickname":"Example",
  "securityEnabled":false,
  "visibility":"Public"
}