I was approached with a scenario: Once I have created a Private Channel how can I automatically copy files there? Since I didn’t have a direct answer it was time to open Graph Explorer and start digging.
Create a Private Channel
You need to have a suitable team first.
/me/joinedTeams is quite a good Graph API path for that.
Store that TeamID and create a private channel:
POST
https://graph.microsoft.com/beta/teams/{TeamID}/channels
{
"@odata.type": "#Microsoft.Teams.Core.channel",
"membershipType": "private",
"displayName": "Inner loop",
"description": "This is for private content"
}
In return you get a Private Channel ID. Store that too. Just for kicks check that do you get any tabs returned.
https://graph.microsoft.com/v1.0/teams/{TeamID}/channels/{PrivateChannelID}/tabs?$expand=teamsApp
Of course you don’t get any tabs. Posts and Files are not returned with tabs query!
So let’s create tab.
POST
https://graph.microsoft.com/v1.0/teams/{TeamID}/channels/{PrivateChannelID}/tabs
{
"displayName": "website",
"teamsApp@odata.bind" : "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/com.microsoft.teamspace.tab.web",
"configuration": {
"contentUrl": "https://yourtenant.sharepoint.com/sites/intranet"
}
}
Now if you try to retrieve tabs you get the website tab in the return set.
Get the Site
If you are thinking to use the source team to retrieve private channel’s drive.. you are going down the wrong path easily.
Facts:
#1: Private Channel is it’s own site collection.
#2: Private Channel is not a group
#3: Private channel site collection is named: sourceteamsite-privatechannelname
First we need to get the source team’s site collection name.
https://graph.microsoft.com/beta/groups/{TeamID}/sites/root
Store the Sitename and add private channel internal name to it without spaces.
Now we can retrieve the Site information:
https://graph.microsoft.com/beta/sites/yourtenant.sharepoint.com:/sites/storemanagers-innerloop
Again: store the SiteId. This id is a long one.

Get the Drive and Folder ID
Next: get drives of the Site. You need to look for the Document Library ( wheredriveType=”documentLibrary in the result set)
https://graph.microsoft.com/beta/sites/{SiteID}/drives
Store the Document Library Drive id
And no, you are not done. You need to retrieve the drive’s root id.
https://graph.microsoft.com/beta/drives/{DocumentLibraryDriveID)/root
Store the RootID
Now.. Retrieve all items of that drive’s root.
https://graph.microsoft.com/beta/drives/{DocumentLibraryDriveID}/items/{RootID}/children
There should be only one entity: the folder named by your Private channel team! Store PrivateChannelFolderID.
Copy the file into Private Channel
Copying file is tricky if you don’t pay attention. You need to use URL for the source file and JSON body for the target (=your Private channel folder).

POST
https://graph.microsoft.com/beta/drives/{SourceDocumentLibraryDriveID)/items/{SourceItemID}/copy
{
"parentReference": {
"driveId": "{DocumentLibraryDriveID}",
"id": "{PrivateChannelFolderID}"
},
"name": "Teams Spotlight 20200218.pptx"
}
And you are done!
You can retrieve files with Graph API using /drives/{DocumentLibraryDriveID}/items/{PrivateChannelFolderID}/children

But of course it is easier to check with Teams app:

And yes – that is the new Files Experience. It just appeared on my dev tenant today!