Bewerken

Delen via


Permanently delete item (directory object)

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.

Permanently delete a recently deleted application, externalUserProfile, group, pendingExternalUserProfile, servicePrincipal, or user object from deleted items. After an item is permanently deleted, it cannot be restored.

Administrative units cannot be permanently deleted by using the deletedItems API. Soft-deleted administrative units will be permanently deleted 30 days after initial deletion unless they are restored.

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
application Application.ReadWrite.All Not supported. Application.ReadWrite.OwnedBy
externalUserProfile ExternalUserProfile.ReadWrite.All Not supported ExternalUserProfile.ReadWrite.All
group Group.ReadWrite.All Not supported. Not supported.
pendingExternalUserProfile PendingExternalUserProfile.ReadWrite.All Not supported PendingExternalUserProfile.ReadWrite.All
servicePrincipal Application.ReadWrite.All Not supported. Application.ReadWrite.OwnedBy
user User.ReadWrite.All Not supported. Not supported.

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.

  • To permanently delete deleted applications or service principals: Application Administrator, Cloud Application Administrator, or Hybrid Identity Administrator.
  • To permanently delete deleted users: User Administrator.
  • To permanently delete deleted groups: Groups Administrator.

HTTP request

DELETE /directory/deleteditems/{id}

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 204 No Content response code. It doesn't return anything in the response body.

Example

Request

DELETE https://graph.microsoft.com/beta/directory/deleteditems/46cc6179-19d0-473e-97ad-6ff84347bbbb

Response

Note: The response object shown here might be shortened for readability.

HTTP/1.1 204 No Content