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.
When an application queries a relationship that returns a directoryObject type collection, if it does not have permission to read a certain derived type (like device), members of that type are returned but with limited information. With this behavior, applications can request the least privileged permissions they need, rather than rely on the set of Directory.* permissions. For details, see Limited information returned for inaccessible member objects.
HTTP request
GET /directory/deleteditems/microsoft.graph.application
GET /directory/deleteditems/microsoft.graph.servicePrincipal
GET /directory/deletedItems/microsoft.graph.group
GET /directory/deletedItems/microsoft.graph.user
GET /directory/deletedItems/microsoft.graph.administrativeUnit
The OData cast type is a required part of the URI and calling GET /directory/deleteditems without a type is not supported.
Optional query parameters
This method supports the query parameters that are supported by the resource that is specified by the OData cast. That is, $count, $expand, $filter, $orderby, $search, $select, and $top query parameters. This API returns 100 objects by default and supports returning up to 999 objects per page using $top.
Some queries are supported only when you use the ConsistencyLevel header set to eventual and $count. For example:
GET https://graph.microsoft.com/beta/directory/deletedItems/microsoft.graph.group?&$count=true&$orderby=deletedDateTime desc&$select=id,displayName,deletedDateTime
ConsistencyLevel: eventual
This example requires the ConsistencyLevel header because the $orderby and $count query parameters are used in the query.
Examples using the $orderby OData query parameter
The $orderby OData query parameter is supported on the deletedDateTime, displayName, and userPrincipalName properties of the deleted object types. On the deletedDateTime property, the query requires adding the advanced query parameters (ConsistencyLevel header set to true and $count=true query string).
GET https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.DeletedItems.GraphGroup.GetAsync();
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->directory()->deletedItems()->graphGroup()->get()->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(credentials, scopes)
result = await graph_client.directory.deleted_items.graph_group.get()
GET https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group?$count=true&$orderby=deletedDateTime asc&$select=id,DisplayName,deletedDateTime
ConsistencyLevel: eventual
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Directory.DeletedItems.GraphGroup.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Count = true;
requestConfiguration.QueryParameters.Orderby = new string []{ "deletedDateTime asc" };
requestConfiguration.QueryParameters.Select = new string []{ "id","DisplayName","deletedDateTime" };
requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc directory deleted-items graph-group get --count "true" --orderby "deletedDateTime asc" --select "id,DisplayName,deletedDateTime"