命名空间:microsoft.graph
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
从 已删除的项中检索最近删除的目录对象的列表。 支持以下类型:
- administrativeUnit
- application
- agentIdentityBlueprint
- agentIdentity
- agentIdentityBlueprintPrincipal
- agentUser
- certificateBasedAuthPki
- certificateAuthorityDetail
- 设备
- externalUserProfile
- 组
- pendingExternalUserProfile
- servicePrincipal
- 用户
此 API 可用于以下国家级云部署。
| 全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
权限
下表显示了对每种受支持的资源类型调用此 API 所需的最低特权。 遵循 最佳做法 请求最低特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 支持的资源 | 委派(工作或学校帐户) | 委派(个人 Microsoft 帐户) | 应用程序 |
|---|---|---|---|
| administrativeUnit | AdministrativeUnit.Read.All | 不支持。 | AdministrativeUnit.Read.All |
| application | Application.Read.All | 不支持。 | Application.Read.All |
| agentIdentity | AgentIdentity.Read.All | 不支持。 | AgentIdentity.Read.All |
| agentIdentityBlueprint | AgentIdentityBlueprint.Read.All | 不支持。 | AgentIdentityBlueprint.Read.All |
| agentIdentityBlueprintPrincipal | AgentIdentityBlueprintPrincipal.Read.All | 不支持。 | AgentIdentityBlueprintPrincipal.Read.All |
| agentUser | User.ReadBasic.All | 不支持。 | User.ReadBasic.All |
| 设备 | Device.Read.All | 不支持。 | Device.Read.All |
| externalUserProfile | ExternalUserProfile.Read.All | 不支持 | ExternalUserProfile.Read.All |
| 组 | Group.Read.All | 不支持。 | Group.Read.All |
| pendingExternalUserProfile | PendingExternalUserProfile.Read.All | 不支持 | PendingExternalUserProfile.Read.All |
| servicePrincipal | Application.Read.All | 不支持。 | Application.Read.All |
| user | User.Read.All | 不支持。 | User.Read.All |
| certificateBasedAuthPki | PublicKeyInfrastructure.Read.All | 不支持。 | PublicKeyInfrastructure.Read.All |
| certificateAuthorityDetail | PublicKeyInfrastructure.Read.All | 不支持。 | PublicKeyInfrastructure.Read.All |
重要
当应用程序查询返回 directoryObject 类型集合的关系时,如果它无权读取特定资源类型,则返回该类型的成员,但信息有限。 例如,仅返回对象类型和 ID 的 @odata.type 属性,而其他属性表示为 null。 使用此行为,应用程序可以请求它们需要的最小特权权限,而不是依赖 Directory 集。* 权限。 有关详细信息,请参阅为不可访问的成员对象返回有限的信息。
HTTP 请求
GET /directory/deletedItems/microsoft.graph.application
GET /directory/deletedItems/microsoft.graph.device
GET /directory/deletedItems/microsoft.graph.servicePrincipal
GET /directory/deletedItems/microsoft.graph.group
GET /directory/deletedItems/microsoft.graph.user
GET /directory/deletedItems/microsoft.graph.administrativeUnit
GET /directory/deletedItems/microsoft.graph.externalUserProfile
GET /directory/deletedItems/microsoft.graph.pendingExternalUserProfile
GET /directory/deletedItems/microsoft.graph.certificateBasedAuthPki
GET /directory/deletedItems/microsoft.graph.certificateAuthorityDetail
重要
对于软删除的安全组, securityEnabled 属性会返回 false ,而不是 true 由于已知限制。
要标识组类型,请使用 groupTypes 属性:
-
["Unified"]指示 Microsoft 365 组。 - 空数组 ()
[]表示安全组。
OData 强制转换类型是 URI 的必需部分,不支持没有类型的调用GET /directory/deletedItems。
可选的查询参数
此方法支持 OData 强制转换指定的资源支持的查询参数。 即 $count、 $expand、 $filter、 $orderby、 $search$select和$top查询参数。 此 API 默认返回 100 个对象,并支持使用每 $top页返回最多 999 个对象。
只有将 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查询中使用了 QUERY 参数。
$orderby OData 查询参数示例
$orderby已删除对象类型的 deletedDateTime、displayName 和 userPrincipalName 属性支持 OData 查询参数。 在 deletedDateTime 属性上,该查询需要添加 高级查询参数 (ConsistencyLevel 标头设置到 eventual 并 $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 | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| 接受 | application/json |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和 directoryObject 对象集合。
示例
示例 1:检索已删除的组
请求
GET https://graph.microsoft.com/beta/directory/deletedItems/microsoft.graph.group
响应
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/beta/$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/beta/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/beta/$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"
}
]
}