Ashish8970
Ashish8970

Reputation: 27

Getting "Unsupported sort property 'deletedDateTime' for 'Group'" error

I am trying to get the list of deleted Azure AD groups via Graph API by using below query:

GET
https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group?$count=true&$orderBy=deletedDateTime+asc&$select=id,DisplayName,deletedDateTime

But I got the error like below:

{ "error": { "code": "Request_UnsupportedQuery", "message": "Unsupported sort property 'deletedDateTime' for 'Group'.", "innerError": { "date": "2022-05-20T10:30:41", "request-id": "2884a7a0-ee08-4484-b63a-d927310c1dde", "client-request-id": "0ec6c500-e899-65bf-acd8-dbd786c59773" } } }

Can anyone help me with this error? I have all the required permissions,not understanding what's going wrong.

Upvotes: 1

Views: 629

Answers (1)

Sridevi
Sridevi

Reputation: 22542

The error usually occurs if you missed adding required header while executing the query.

I tried to reproduce the same in my environment without adding the header and got below error:

enter image description here

To resolve the error, make sure to add header as ConsistencyLevel: eventual like below:

enter image description here

After adding the header got the results successfully like below:

enter image description here

Reference:

List deletedItems (directory objects) - Microsoft Graph v1.0 | Microsoft Docs

Upvotes: 1

Related Questions