skip to Main Content

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


  1. 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 and channelId.

    GET /teams/{teamId}/channels/{channelId}/filesFolder
    

    The response should contain id of driveItem and parentReference with driveId.

    Now you have driveId and driveItemId, so you can upload documents using the following endpoint.

    Login or Signup to reply.
  2. 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:

    https://graph.microsoft.com/v1.0/groups/<groupid>/sites/root?$select=webUrl
    

    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.

    slice(outputs('Send_an_HTTP_request_-_Create_Team')['Headers']['Content-Location'], 8, -2)
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search