Same than "https://graph.microsoft.com/v1.0/me/joinedTeams" but using REST API

Pablo Glomby 186 Reputation points
2021-01-12T14:31:13.727+00:00

Hi!
I need to get, for each user in Office 365, the SharePoint Online sites associated to Teams: The teams the user owns, and the teams the user has joined to.
What I do is to call this to get the team IDs (for the owned and "joined to" teams):
https://graph.microsoft.com/v1.0/me/joinedTeams

Then for each team ID I call:
https://graph.microsoft.com/v1.0/groups/"+szTeamId+"/sites/root"

It works OK if I have a graph token, but some customers don't want to register an application so all I have is the username+password (so I have to use SharePointOnlineCredentials). This means that I can only use the REST API (or the CSOM API).

Is there any way to do the same using REST API (or CSOM API but I doubt).

Thanks

Microsoft Teams | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
Microsoft Security | Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,126 Reputation points
    2021-01-13T02:20:32.697+00:00

    Hi @Pablo Glomby ,

    The short answer is no. We cannot get the team IDs through SharePoint REST API or CSOM API.

    Microsoft Graph api can access data on many Microsoft clould apps (SharePoint, Teams, outlooks...): https://learn.microsoft.com/en-us/graph/overview?view=graph-rest-1.0#whats-in-microsoft-graph

    However, SharePoint REST API or CSOM API can only access data stored in SharePoint, like sites, lists, listitems... It cannot get resources in other apps.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.
    0 comments No comments

  2. Oscar Maqueda 611 Reputation points Microsoft Employee
    2021-01-12T21:21:32.073+00:00
    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.