Using a username and password is considered insecure and you should switch to Client ID + Certificate or less preferably, Secret. The Graph API is how you need to pull this info.
Check if a given SharePoint site belongs to Teams (SharePoint REST API, or CSOM)
Hi!
I cannot use Microsoft Graph (else it would be easy) because I cannot get the Graph Token (I use the SharePointOnlineCredentials with username/password).
So all I can use is CSOM and the REST API.
Right now I get the frequent sites using this REST API:
https://<your_tenant>/_vti_bin/homeapi.ashx/sites/recent?SPHome-ClientType=SharePointIOS&mostRecentFirst=true&start=0&count=100
It returns the recent sharepoint sites including those belonging to Teams. I need to know if a given site belongs to Teams or not.
I have read that using the WebTemplate value would be enough (if it is Group) but I discovered that I can manually create a SP site and it can hold this value.
Is there a reliable way to know if a given site is used in Teams?
Thanks
2 answers
Sort by: Most helpful
-
-
MichaelHan-MSFT 18,016 Reputation points
2021-03-18T06:37:30.273+00:00 Hi @Pablo Glomby ,
Using SharePoint Rest Api or CSOM, we cannot check if the site is used in Teams. As you said, we can only get the WebTemplate value. But that's not enough.
As far as I know, when a site is used in Teams, the assosiated M365 group will have Teams connected. You can identify go to admin center> Groups>there you can see Teams status and symbol to identify that SharePoint site is used in Microsoft Teams. See image below for your reference.
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.