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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,715 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,739 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,886 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 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