列出 joinedTeams
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
获取用户不是其直接成员的 Microsoft Teams 团队 。
注意 :此 API 不会返回用户是其直接成员的共享通道的主机团队。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Team.ReadBasic.All、TeamSettings.Read.All、TeamSettings.ReadWrite.All、User.Read.All、User.ReadWrite.All、Directory.Read.All 、Directory.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
Team.ReadBasic.All、TeamSettings.Read.All、TeamSettings.ReadWrite.All、User.Read.All、User.ReadWrite.All、Directory.Read.All 、Directory.ReadWrite.All
Note : 仅支持使用 ** 标记的权限以实现向后兼容。 建议你更新解决方案以使用上表中列出的替代权限,并避免今后使用这些权限。
注意: 目前,使用用户委派的权限时,此操作仅适用于“me”用户。 使用应用程序权限时,此操作通过指定特定用户 ID 而适用于所有用户 ID。(使用应用程序权限时,不支持“me”别名)。 有关详细信息,请参阅已知问题 。
HTTP 请求
GET /me/joinedTeams
GET /users/{id | user-principal-name}/joinedTeams
可选的查询参数
此运营商当前不支持通过 OData 查询参数 来自定义响应。
标头
值
Authorization
Bearer {token}。必需。
接受
application/json
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和 团队 对象集合。
备注
目前,此 API 调用仅返回 团队 的 id 、displayName 和 说明 属性。 若要获取所有属性,请使用获取团队 操作。 有关详细信息,请参阅已知问题 。
示例
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/me/joinedTeams
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var joinedTeams = await graphClient.Me.JoinedTeams
.Request()
.GetAsync();
const options = {
authProvider,
};
const client = Client.init(options);
let joinedTeams = await client.api('/me/joinedTeams')
.version('beta')
.get();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/joinedTeams"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphTeam *team = [[MSGraphTeam alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
TeamCollectionWithReferencesPage joinedTeams = graphClient.me().joinedTeams()
.buildRequest()
.get();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
result, err := graphClient.Me().JoinedTeams().Get()
Import-Module Microsoft.Graph.Teams
# A UPN can also be used as -UserId.
Get-MgUserJoinedTeam -UserId $userId
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
"displayName": "Contoso Team",
"description": "This is a Contoso team, used to showcase the range of properties supported by this API"
}
]
}
另请参阅