GET /associatedTeams endpoint doesn't return Host Team of a shared channel

Nikita Krivets 496 Reputation points
2022-09-07T20:03:58.263+00:00

Hello,

Documentation (https://learn.microsoft.com/en-us/graph/api/associatedteaminfo-list?view=graph-rest-1.0&tabs=http) states that

a user can be associated with a team in two different ways:

  • A user can be a direct member of a team.
  • A user can be a member of a shared channel that is hosted inside a team.

The second way doesn't seem to work properly.

Here is an example:

I have created a shared channel and named it "Shared Channel".

The hosting team "7615ef18-8b02-4825-98e3-36233315c13e" has this channel among its channel list:

GET https://graph.microsoft.com/v1.0/teams/7615ef18-8b02-4825-98e3-36233315c13e/channels  
{  
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('7615ef18-8b02-4825-98e3-36233315c13e')/channels",  
    "@odata.count": 2,  
    "value": [  
        {  
            "id": "19:d867eb0911b12342bcab14953ddb596a5f@thread.skype",  
            "createdDateTime": "2018-10-12T20:19:27.117Z",  
            "displayName": "General",  
            "description": "Team with mixed quotes in the name. Will mst or mstclient die?",  
            "isFavoriteByDefault": null,  
            "email": "CoolDudes@some_tenant.onmicrosoft.com",  
            "tenantId": "some_tenant",  
            "webUrl": "url",  
            "membershipType": "standard"  
        },  
        {  
            "id": "19:vgeP3OP-ktWyOqHSDGFJSih_Rs4hPNc7WlBRSqdiank1@thread.skype",  
            "createdDateTime": "2022-09-07T18:35:48.149Z",  
            "displayName": "Shared Channel",  
            "description": null,  
            "isFavoriteByDefault": null,  
            "email": null,  
            "tenantId": "some_tenant",  
            "webUrl": "url",  
            "membershipType": "shared"  
        }  
    ]  
}  

Then this shared channel "Shared Channel" was shared with a team called "TestingSharepoint".

GET https://graph.microsoft.com/v1.0/teams/d544dc19-0d4f-4302-bee2-3ecf4e2630b9/allchannels  
{  
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.channel)",  
    "@odata.count": 2,  
    "value": [  
        {  
            "@odata.id": "url",  
            "id": "19:2xhZR3G8gsSSEqGrJGZBGxJLHoEK0X56F@thread.tacv2",  
            "createdDateTime": "2021-11-12T22:11:55.259Z",  
            "displayName": "General",  
            "description": "TestingSharepoint",  
            "isFavoriteByDefault": null,  
            "email": "TestingSharepoint@some_tenant.onmicrosoft.com",  
            "tenantId": "some_tenant",  
            "webUrl": "url",  
            "membershipType": "standard"  
        },  
        {  
            "@odata.id": "url",  
            "id": "19:vgeP3OP-ktWyOqHSDGFJSih_Rs4hPNc7WlBRSqdiank1@thread.skype",  
            "createdDateTime": "2022-09-07T18:35:48.149Z",  
            "displayName": "Shared Channel",  
            "description": null,  
            "isFavoriteByDefault": null,  
            "email": null,  
            "tenantId": "some_tenant",  
            "webUrl": "url",  
            "membershipType": "shared"  
        }  
    ]  
}  

Here is the membership of the team ("TestingSharepoint").

GET https://graph.microsoft.com/v1.0/teams/d544dc19-0d4f-4302-bee2-3ecf4e2630b9/members  
{  
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('d544dc19-0d4f-4302-bee2-3ecf4e2630b9')/members",  
    "@odata.count": 3,  
    "value": [  
        {  
            "@odata.type": "#microsoft.graph.aadUserConversationMember",  
            "id": "WM4YzgxMGUtZDJmOS00ZjhlLWE4NTItYTRjZGY4ZjUyNDQ4IyS0wZDRmLTQzMDItYmVlMi0zZWNmNGUyNjMwYjkjIzc2MGU5MDM0LTIyNDMtNDFmMS05NmQ5LTk5MGQ2YzU4M2QwNw==",  
            "roles": [],  
            "displayName": "Arya Stark",  
            "visibleHistoryStartDateTime": "0001-01-01T00:00:00Z",  
            "userId": "760e9034-2243-41f1-96d9-990d6c583d07",  
            "email": "arya_stark@some_tenant.onmicrosoft.com",  
            "tenantId": "some_tenant"  
        },  
        {  
            "@odata.type": "#microsoft.graph.aadUserConversationMember",  
            "id": "MCMjMSMjNWM4YzgxWE4NTItYTRjZGY4ZjUyNDQ4IyNkNTQ0ZGMxOS0wZDRmLTQzMDItYmVlMi0zZWNmNGk5LWZmMTMtNDJiNC05OWM3LTI2NjRlMWEwM2RlYg==",  
            "roles": [  
                "owner"  
            ],  
            "displayName": "Administrator",  
            "visibleHistoryStartDateTime": "0001-01-01T00:00:00Z",  
            "userId": "325f3c99-ff13-42b4-99c7-2664e1a03deb",  
            "email": "administrator@some_tenant.onmicrosoft.com",  
            "tenantId": "some_tenant"  
        },  
        {  
            "@odata.type": "#microsoft.graph.aadUserConversationMember",  
            "id": "MCMjMSMjNWM4YzgmVlMi0zZWNmNGUyNjMwYjkjIzhkZDYyNGIxLTZmZDgtNDLTU4YTI3NDc4NTkxMg==",  
            "roles": [],  
            "displayName": "Chief",  
            "visibleHistoryStartDateTime": "0001-01-01T00:00:00Z",  
            "userId": "8dd624b1-6fd8-4702-9425-58a274785912",  
            "email": "chief@some_tenant.onmicrosoft.com",  
            "tenantId": "some_tenant"  
        }  
    ]  
}  

Now If we take a user with GUID "760e9034-2243-41f1-96d9-990d6c583d07" and then we try to find associated teams, we will NOT get the promised Host Team "7615ef18-8b02-4825-98e3-36233315c13e".

GET https://graph.microsoft.com/v1.0/users/760e9034-2243-41f1-96d9-990d6c583d07/teamwork/associatedTeams  
{  
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('760e9034-2243-41f1-96d9-990d6c583d07')/teamwork/associatedTeams",  
    "@odata.count": 1,  
    "value": [  
        {  
            "id": "d544dc19-0d4f-4302-bee2-3ecf4e2630b9",  
            "tenantId": "some_tenant",  
            "displayName": "TestingSharepoint"  
        }  
    ]  
}  

Is it supposed to work this way despite the fact that documentation states that a response should contain the host team for a shared channel?

Thanks in advance!

Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.8K Reputation points MVP Volunteer Moderator
    2022-09-08T06:23:32.25+00:00

    Afaik said endpoint, at least in its current version, returns only direct members, as in users explicitly invited to a shared channel. Not those who "inherit" membership via group/team.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Graham Norris 66 Reputation points
    2022-09-08T18:01:37.51+00:00

    @Vasil Michev Does ms have an approved flow for getting teams that have shared a channel with a user's teams? Currently I'm only seeing /incomingChannels which makes the identity of the team who channels belong to somewhat opaque.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.