列出 deletedItems (目录对象)
命名空间:microsoft.graph
检索最近删除的目录对象的列表。 目前,仅应用程序、组和用户资源支持此功能。
目前,删除的项目功能仅支持 应用程序、 servicePrincipal、 组和 用户 资源。
注意: 已删除的安全组将被永久删除,无法通过此 API 检索。
权限
当应用程序查询返回 directoryObject 类型集合的关系时,如果它没有读取某种派生类型(如设备)的权限,则会返回该类型的成员,但返回的信息有限。 使用这种行为,应用程序可请求所需的最低特权权限,而不依赖于 Directory.* 集权限。 有关详细信息,请参阅为不可访问的成员对象返回有限的信息。
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
对于应用程序和服务主体:
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | Application.Read.All、Application.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
| 委派(个人 Microsoft 帐户) | 不支持。 |
| 应用程序 | Application.Read.All、Application.ReadWrite.All、Directory.Read.All |
对于用户:
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
| 委派(个人 Microsoft 帐户) | 不支持。 |
| 应用程序 | User.Read.All、User.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All |
对于组:
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | Group.Read.All、Group.ReadWrite.All、Directory.Read.All |
| 委派(个人 Microsoft 帐户) | 不支持。 |
| 应用程序 | Group.Read.All、Group.ReadWrite.All、Directory.Read.All |
HTTP 请求
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.device
此 API 目前支持检索 () 、servicePrincipals (microsoft.graph.application) 、组 (microsoft.graph.serviceprincipal) microsoft.graph.group 或从已删除项 (microsoft.graph.user) 的用户的对象类型。 OData 强制转换类型是 URI 的必需部分,不 支持不使用类型调用GET /directory/deleteditems。
可选的查询参数
此方法支持由 OData 强制转换指定的资源支持的查询参数。 即、、$count``$expand、$filter、$orderBy、$search``$select和$top查询参数。 只有将 ConsistencyLevel 标头设置为 eventual 和 $count 时,才支持某些查询。 例如:
https://graph.microsoft.com/beta/directory/deletedItems/microsoft.graph.group?&$count=true&$orderBy=deletedDateTime desc&$select=id,displayName,deletedDateTime
ConsistencyLevel: eventual
此示例需要 ConsistencyLevel 标头, $orderBy 因为查询中使用了查询参数和 $count 查询参数。
使用 $orderBy OData 查询参数的示例
已 $orderBy 删除对象类型的 deletedDateTime、 displayName 和 userPrincipalName 属性支持 OData 查询参数。 在 deletedDateTime 属性上,查询需要添加 高级查询参数 (将 ConsistencyLevel 标头设置为true``$count=true查询字符串) 。
| OData 强制转换 | 支持$orderBy的属性 | 示例 |
|---|---|---|
| microsoft.graph.user | deletedDateTime、displayName、userPrincipalName | /directory/deletedItems/microsoft.graph.user?$orderBy=userPrincipalName |
| microsoft.graph.group | deletedDateTime、displayName | /directory/deletedItems/microsoft.graph.group?$orderBy=deletedDateTime asc&$count=true |
| microsoft.graph.application | deletedDateTime、displayName | /directory/deletedItems/microsoft.graph.application?$orderBy=displayName |
| microsoft.graph.device | deletedDateTime、displayName | /directory/deletedItems/microsoft.graph.device?$orderBy=deletedDateTime&$count=true |
请求标头
| 名称 | 说明 |
|---|---|
| Authorization | Bearer <code>。必需 |
| 接受 | application/json |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和 directoryObject 对象集合。
示例
示例 1:检索已删除的组
请求
GET https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups",
"value": [
{
"id":"46cc6179-19d0-473e-97ad-6ff84347bbbb",
"displayName":"SampleGroup",
"groupTypes":["Unified"],
"mail":"example@contoso.com",
"mailEnabled":true,
"mailNickname":"Example",
"securityEnabled":false,
"visibility":"Public"
}
]
}
示例 2:检索已删除用户对象的计数,并按 deletedDateTime 属性对结果进行排序
请求
GET https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.group?$count=true&$orderBy=deletedDateTime asc&$select=id,DisplayName,deletedDateTime
ConsistencyLevel: eventual
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(id,displayName,deletedDateTime)",
"@odata.count": 2,
"value": [
{
"id": "c31799b8-0683-4d70-9e91-e032c89d3035",
"displayName": "Role assignable group",
"deletedDateTime": "2021-10-26T16:56:36Z"
},
{
"id": "74e45ce0-a52a-4766-976c-7201b0f99370",
"displayName": "Role assignable group",
"deletedDateTime": "2021-10-26T16:58:37Z"
}
]
}
反馈
提交和查看相关反馈