Connecting SharePoint Online Teams Site With Microsoft teams team Programmatically

Copper Contributor

Hi,

 

Recently I had a requirement to create a SharePoint online teams site and, connect created teams site to Microsoft teams (as a group.) So I have gone through and I found out that using REST API I can create a SP Online Teams site via "/_api/GroupSiteManager/CreateGroupEx" by passing the relevant JSON. I have successfully done it.

Then my second requirement was to connect created site into Microsoft Teams. I can do it manually inside of the created site, by clicking "Connect to teams" link. I wanted that to be programmatically. I couldn't find any API end point related to that and what I did was opened my network tab and checked the request and payload. Flowing attached is the image of the payload. 

 

3.PNG

So simply what I did was called the endpoint "/_api/GroupSiteManager/PinToTeam" and Sent the relevant JSON. And that point I am getting an error as following: 

 

{"error":{"code":"-1, Microsoft.Data.OData.ODataException","message":{"lang":"en-US","value":"The property '__metadata' does not exist on type 'Microsoft.SharePoint.Portal.PinToTeamParams'. Make sure to only use property names that are defined by the type."}}}

 

When I searched I couldn't find any related to "/_api/GroupSiteManager/PinToTeam". Could someone please help me to resolve this error?

Thanks

@gimhara 

 

 

0 Replies