I am currently building a system that sets up a team for a ‘project’, and want to automate the upload of necessary documents. The files tab in the team is linked to a sharepoint site which i can get the link to manually through Teams, but i cant find any form of link to the site, or ID in the api response. I have looked through the documentation and cant find anything, any help would be appreciated.
I have tried using the team ID as the site ID, aswell as any other ID or path, in a ‘get site’ request. i have used the data returned from the teamsAsyncOperation in the same manner. Which all return {"code": "itemNotFound", "message": "Item not found"}
2
Answers
The files tab in the team’s channel is linked to a driveItem through filesFolder relationship.
To get the metadata for the location where the files of a channel are stored you need to use
teamId
andchannelId
.The response should contain
id
ofdriveItem
andparentReference
withdriveId
.Now you have
driveId
anddriveItemId
, so you can upload documents using the following endpoint.You can access a group team site via /sites/root
https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http#access-a-group-team-site
Try something like:
You can reuse the Group Id from the Create Team request. That id should be listed in the Content-Location field of the Response Headers. You can retrieve that via a slice function.