命名空间:microsoft.graph
获取组对象的属性和关系。
此操作在默认情况下仅返回所有可用属性的一部分,如
属性
部分中所示。 若要获取默认返回t_的属性,请在 OData 查询选项中
$select
指定它们。
hasMembersWithLicenseErrors
和
isArchived
属性是一个异常,不会在查询中
$select
返回。
注意:
此请求可能对最近创建、更新或删除的组具有复制延迟。
此 API 可用于以下
国家级云部署
。
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
委派(工作或学校帐户)
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
获取特定的组属性,包括默认情况下不返回的属性。 扩展属性还支持查询参数,如下所示:
// 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();
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-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 client = Client.init(options);
let group = await client.api('/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315')
.get();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph 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()
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups/$entity",
"id": "02bd9fd6-8f93-4758-87c3-1fb73740a315",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2017-07-31T18:56:16Z",
"description": "Welcome to the HR Taskforce team.",
"displayName": "HR Taskforce",
"expirationDateTime": null,
"groupTypes": [
"Unified"
"isAssignableToRole": null,
"mail": "HRTaskforce@contoso.com",
"mailEnabled": true,
"mailNickname": "HRTaskforce",
"membershipRule": null,
"membershipRuleProcessingState": null,
"onPremisesDomainName": null,
"onPremisesLastSyncDateTime": null,
"onPremisesNetBiosName": null,
"onPremisesSamAccountName": null,
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"preferredDataLocation": null,
"preferredLanguage": null,
"proxyAddresses": [
"SMTP:HRTaskforce@contoso.com",
"SPO:SPO_896cf652-b200-4b74-8111-c013f64406cf@SPO_dcd219dd-bc68-4b9b-bf0b-4a33a796be35"
"renewedDateTime": "2020-01-24T19:01:14Z",
"resourceBehaviorOptions": [],
"resourceProvisioningOptions": [
"Team"
"securityEnabled": false,
"securityIdentifier": "S-1-12-1-45981654-1196986259-3072312199-363020343",
"serviceProvisioningErrors": [],
"theme": null,
"visibility": "Private",
"onPremisesProvisioningErrors": []
示例 2:使用 $select 返回更多属性
使用 $select
返回更多属性。
下面是 GET 请求的示例。
// 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" };
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphgroups "github.com/microsoftgraph/msgraph-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 client = Client.init(options);
let group = await client.api('/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315')
.select('allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount')
.get();
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\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();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.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)
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(allowExternalSenders,autoSubscribeNewMembers,isSubscribedByMail,unseenCount)/$entity",
"id": "02bd9fd6-8f93-4758-87c3-1fb73740a315",
"allowExternalSenders": false,
"autoSubscribeNewMembers": false,
"isSubscribedByMail": false,
"unseenCount": 3