名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
group オブジェクトのプロパティとリレーションシップを取得します。
「プロパティ」セクションに記載されているように、この操作は既定ですべての使用できるプロパティのサブセットのみを返します。 既定で返t_プロパティを取得するには、 $select
OData クエリ オプションでプロパティを指定します。
hasMembersWithLicenseErrors プロパティと isArchived プロパティは例外であり、$select
クエリでは返されません。
グループ リソースは拡張機能をサポートしているため、GET
操作を使用して、グループ インスタンスでカスタム プロパティと拡張機能データを取得することもできます。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
GroupMember.Read.All |
Group.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All、Group.Read.All |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
GroupMember.Read.All |
Group.ReadWrite.All、Directory.Read.All、Directory.ReadWrite.All、Group.Read.All |
HTTP 要求
GET /groups/{id}
オプションのクエリ パラメーター
$select
を使用して、既定で返されないプロパティなど、特定のグループ プロパティを取得できます。 拡張機能プロパティでは、次のようにクエリ パラメーターもサポートされます。
拡張機能の種類 |
コメント |
スキーマ拡張機能 |
$select でのみ返されます。 |
オープン拡張機能 |
[オープン拡張機能を取得する] 操作を通じて返されます。 |
ディレクトリ拡張機能 |
既定で返されます。 |
OData クエリ オプションの詳細については、「OData クエリ パラメーター」を参照してください。
名前 |
型 |
説明 |
Authorization |
string |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK
応答コードと、応答本文で group オブジェクトを返します。
$select
を使用して特定のプロパティを指定していない限り、既定のプロパティを返します。
例
例 1: すべての既定のプロパティを返す
要求
GET 要求の例を次に示します。
GET https://graph.microsoft.com/beta/groups/45b7d2e7-b882-4a80-ba97-10b7a63b8fa4
// 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.Groups["{group-id}"].GetAsync();
mgc-beta groups get --group-id {group-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groups, err := graphClient.Groups().ByGroupId("group-id").Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Group result = graphClient.groups().byGroupId("{group-id}").get();
const options = {
authProvider,
};
const client = Client.init(options);
let group = await client.api('/groups/45b7d2e7-b882-4a80-ba97-10b7a63b8fa4')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->groups()->byGroupId('group-id')->get()->wait();
Import-Module Microsoft.Graph.Beta.Groups
Get-MgBetaGroup -GroupId $groupId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.groups.by_group_id('group-id').get()
応答
応答の例を下に示します。 既定のプロパティのみが含まれています。
注: ここに示す応答オブジェクトは、読みやすいように短縮されている場合があります。 実際の呼び出しでは、すべて既定のプロパティが返されます。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#groups/$entity",
"@odata.id": "https://graph.microsoft.com/v2/45b7d2e7-b882-4a80-ba97-10b7a63b8fa4/directoryObjects/4de51a22-3289-4ea5-bbdb-8503ea644f1b/Microsoft.DirectoryServices.Group",
"id": "4de51a22-3289-4ea5-bbdb-8503ea644f1b",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2021-09-13T10:07:01Z",
"createdByAppId": "de8bc8b5-d9f9-48b1-a8ad-b748da725064",
"organizationId": "45b7d2e7-b882-4a80-ba97-10b7a63b8fa4",
"description": "Self help community for library",
"displayName": "Library Assist",
"expirationDateTime": "2022-01-11T10:07:01Z",
"groupTypes": [
"Unified"
],
"infoCatalogs": [],
"isAssignableToRole": null,
"isManagementRestricted": null,
"mail": "library@contoso.com",
"mailEnabled": true,
"mailNickname": "library",
"membershipRule": null,
"membershipRuleProcessingState": null,
"onPremisesDomainName": null,
"onPremisesLastSyncDateTime": null,
"onPremisesNetBiosName": null,
"onPremisesSamAccountName": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"preferredDataLocation": "EU",
"preferredLanguage": null,
"proxyAddresses": [
"SPO:SPO_0dbffe23-f6fb-4478-adcd-880daf88bb12@SPO_45b7d2e7-b882-4a80-ba97-10b7a63b8fa4",
"SMTP:library@contoso.com"
],
"renewedDateTime": "2021-09-13T10:07:01Z",
"resourceBehaviorOptions": [],
"resourceProvisioningOptions": [],
"securityEnabled": false,
"securityIdentifier": "S-1-12-1-1306860066-1319449225-59104187-458188010",
"serviceProvisioningErrors": [],
"theme": null,
"visibility": "Public",
"writebackConfiguration": {
"isEnabled": null,
"onPremisesGroupType": null
},
"onPremisesProvisioningErrors": []
}
例 2: $selectを使用してプロパティを返す
要求
GET 要求の例を次に示します。
GET https://graph.microsoft.com/beta/groups/b320ee12-b1cd-4cca-b648-a437be61c5cd?$select=allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount
// 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.Groups["{group-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "allowExternalSenders","autoSubscribeNewMembers","isSubscribedByMail","unseenCount" };
});
mgc-beta groups get --group-id {group-id} --select "allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount"
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphgroups "github.com/microsoftgraph/msgraph-beta-sdk-go/groups"
//other-imports
)
requestParameters := &graphgroups.GroupItemRequestBuilderGetQueryParameters{
Select: [] string {"allowExternalSenders","autoSubscribeNewMembers","isSubscribedByMail","unseenCount"},
}
configuration := &graphgroups.GroupItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groups, err := graphClient.Groups().ByGroupId("group-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Group result = graphClient.groups().byGroupId("{group-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"allowExternalSenders", "autoSubscribeNewMembers", "isSubscribedByMail", "unseenCount"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let group = await client.api('/groups/b320ee12-b1cd-4cca-b648-a437be61c5cd')
.version('beta')
.select('allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\GroupItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GroupItemRequestBuilderGetRequestConfiguration();
$queryParameters = GroupItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["allowExternalSenders","autoSubscribeNewMembers","isSubscribedByMail","unseenCount"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->groups()->byGroupId('group-id')->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Groups
Get-MgBetaGroup -GroupId $groupId -Property "allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.groups.item.group_item_request_builder import GroupItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = GroupItemRequestBuilder.GroupItemRequestBuilderGetQueryParameters(
select = ["allowExternalSenders","autoSubscribeNewMembers","isSubscribedByMail","unseenCount"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.groups.by_group_id('group-id').get(request_configuration = request_configuration)
応答
要求された既定以外のプロパティを含む応答の例を次に示します。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#groups(allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount)/$entity",
"id": "b320ee12-b1cd-4cca-b648-a437be61c5cd",
"allowExternalSenders": false,
"autoSubscribeNewMembers": false,
"isSubscribedByMail": false,
"unseenCount": 0
}
例 3: 特定の動的グループを読み取る
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/groups/1cdf9c18-a7dc-46b1-b47f-094d5656376d?$select=id,membershipRule,membershipRuleProcessingState,membershipRuleProcessingStatus
応答
次の例は応答を示しています。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#groups(id,membershipRule,membershipRuleProcessingState,membershipRuleProcessingStatus)/$entity",
"id": "1cdf9c18-a7dc-46b1-b47f-094d5656376d",
"membershipRule": "accountEnabled eq true",
"membershipRuleProcessingState": "On",
"membershipRuleProcessingStatus": {
"status" : "NotStarted",
"lastMembershipUpdated" : null,
"errorMessage" : null
}
}
例 4: グループの管理が制限されているかどうかを確認する
次の例は、グループの管理が制限されているかどうかをチェックする方法を示しています。
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/beta/groups/aed0b780-965f-4149-85c5-a8c73e58brt6?$select=isManagementRestricted
// 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.Groups["{group-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Select = new string []{ "isManagementRestricted" };
});
mgc-beta groups get --group-id {group-id} --select "isManagementRestricted"
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphgroups "github.com/microsoftgraph/msgraph-beta-sdk-go/groups"
//other-imports
)
requestParameters := &graphgroups.GroupItemRequestBuilderGetQueryParameters{
Select: [] string {"isManagementRestricted"},
}
configuration := &graphgroups.GroupItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
groups, err := graphClient.Groups().ByGroupId("group-id").Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Group result = graphClient.groups().byGroupId("{group-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.select = new String []{"isManagementRestricted"};
});
const options = {
authProvider,
};
const client = Client.init(options);
let group = await client.api('/groups/aed0b780-965f-4149-85c5-a8c73e58brt6')
.version('beta')
.select('isManagementRestricted')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Groups\Item\GroupItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new GroupItemRequestBuilderGetRequestConfiguration();
$queryParameters = GroupItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->select = ["isManagementRestricted"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->groups()->byGroupId('group-id')->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Groups
Get-MgBetaGroup -GroupId $groupId -Property "isManagementRestricted"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.groups.item.group_item_request_builder import GroupItemRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = GroupItemRequestBuilder.GroupItemRequestBuilderGetQueryParameters(
select = ["isManagementRestricted"],
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.groups.by_group_id('group-id').get(request_configuration = request_configuration)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"isManagementRestricted": true
}
関連コンテンツ