deletedItems (ディレクトリ オブジェクト) を一覧表示する
[アーティクル]
09/07/2023
17 人の共同作成者
フィードバック
この記事の内容
名前空間: microsoft.graph
最近削除されたディレクトリ オブジェクトの一覧を取得します。 現在、削除されたアイテムの機能は、 アプリケーション 、 servicePrincipal 、 グループ 、 管理単位 、 およびユーザー リソースでのみサポートされています。
メモ: 削除されたセキュリティ グループは完全に削除され、この API を使用して取得することはできません。
この API は、次の国内クラウド展開 で使用できます。
グローバル サービス
米国政府機関 L4
米国政府機関 L5 (DOD)
21Vianet が運営する中国
✅
✅
✅
✅
アクセス許可
次の表は、サポートされている各リソースの種類でこの API を呼び出すために必要な最小特権のアクセス許可またはアクセス許可を示しています。 ベスト プラクティス に従って、最小限の特権のアクセス許可を要求します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「 アクセス許可の種類 」を参照してください。 これらのアクセス許可の詳細については、 アクセス許可のリファレンスを参照してください 。
サポートされているリソース
委任 (職場または学校のアカウント)
委任 (個人用 Microsoft アカウント)
アプリケーション
administrativeUnit
AdministrativeUnit.Read.All
サポートされていません。
AdministrativeUnit.Read.All
application
Application.Read.All
サポートされていません。
Application.Read.All
グループ
Group.Read.All
サポートされていません。
Group.Read.All
servicePrincipal
Application.Read.All
サポートされていません。
Application.Read.All
user
User.Read.All
サポートされていません。
User.Read.All
アプリケーションが directoryObject 型コレクションを返すリレーションシップを照会する場合、特定の派生型 (デバイスなど) を読み取るアクセス許可がない場合、その型のメンバーは返されますが、情報は限られています。 この動作により、アプリケーションはディレクトリのセットに依存するのではなく、必要な最小限の特権のアクセス許可を要求できます 。 *アクセス 許可。 詳細については、「アクセスできないメンバー オブジェクトについて、限定された情報が返される 」を参照してください。
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.administrativeUnit
OData キャスト型は URI の必須部分であり、型なしでの呼び出し GET /directory/deleteditems
はサポート されていません 。
オプションのクエリ パラメーター
このメソッドは、OData キャストによって指定されたリソースでサポートされるクエリ パラメーターをサポートします。 つまり、$count
$expand
、$filter
、、$search
$orderby
$select
および$top
クエリ パラメーターです。 この API は、既定で 100 個のオブジェクトを返し、 を使用して $top
ページあたり最大 999 個のオブジェクトを返します。
クエリの中には、ConsistencyLevel ヘッダーの設定を eventual
および $count
に使用した場合にのみサポートされるものもあります。 以下に例を示します。
GET https://graph.microsoft.com/beta/directory/deletedItems/microsoft.graph.group?&$count=true&$orderby=deletedDateTime desc&$select=id,displayName,deletedDateTime
ConsistencyLevel: eventual
この例では、 パラメーターと $count
クエリ パラメーターがクエリで使用されるため$orderby
、ConsistencyLevel ヘッダーが必要です。
OData クエリ パラメーターの例を$orderbyする
$orderby
OData クエリ パラメーターは、削除されたオブジェクト型の deletedDateTime 、displayName 、userPrincipalName プロパティでサポートされています。 deletedDateTime プロパティでは、クエリで高度なクエリ パラメーター (ConsistencyLevel ヘッダーが に設定され、$count=true
クエリ文字列) を追加するeventual
必要があります。
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/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();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
graphGroup, err := graphClient.Directory().DeletedItems().GraphGroup().Get(context.Background(), nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
GroupCollectionResponse result = graphClient.directory().deletedItems().graphGroup().get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
let group = await client.api('/directory/deletedItems/microsoft.graph.group')
.get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->directory()->deletedItems()->graphGroup()->get()->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
graph_client = GraphServiceClient(credentials, scopes)
result = await graph_client.directory.deleted_items.graph_group.get()
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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
// 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");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// 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"
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphdirectory "github.com/microsoftgraph/msgraph-sdk-go/directory"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
headers := abstractions.NewRequestHeaders()
headers.Add("ConsistencyLevel", "eventual")
requestCount := true
requestParameters := &graphdirectory.DirectoryDeletedItemsGraph.groupRequestBuilderGetQueryParameters{
Count: &requestCount,
Orderby: [] string {"deletedDateTime asc"},
Select: [] string {"id","DisplayName","deletedDateTime"},
}
configuration := &graphdirectory.DirectoryDeletedItemsGraph.groupRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}
graphGroup, err := graphClient.Directory().DeletedItems().GraphGroup().Get(context.Background(), configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
GroupCollectionResponse result = graphClient.directory().deletedItems().graphGroup().get(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");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
let group = await client.api('/directory/deletedItems/microsoft.graph.group')
.header('ConsistencyLevel','eventual')
.select('id,displayName,deletedDateTime')
.orderby('deletedDateTime asc')
.get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Directory\DeletedItems\Graph\Group\GroupRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GraphGroupRequestBuilderGetRequestConfiguration();
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->headers = $headers;
$queryParameters = GraphGroupRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->count = true;
$queryParameters->orderby = ["deletedDateTime asc"];
$queryParameters->select = ["id","DisplayName","deletedDateTime"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->directory()->deletedItems()->graphGroup()->get($requestConfiguration)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
Get-MgDirectoryDeletedItemAsGroup -CountVariable CountVar -Sort "deletedDateTime asc" -Property "id,DisplayName,deletedDateTime"
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.directory.deletedItems.graph.group.group_request_builder import GroupRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = GroupRequestBuilder.GroupRequestBuilderGetQueryParameters(
count = True,
orderby = ["deletedDateTime asc"],
select = ["id","DisplayName","deletedDateTime"],
)
request_configuration = GroupRequestBuilder.GroupRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("ConsistencyLevel", "eventual")
result = await graph_client.directory.deleted_items.graph_group.get(request_configuration = request_configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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"
}
]
}