Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Creating a private channel in HTTP request does not generate sharepoint site

(0) ShareShare
ReportReport
Posted on by 2,563

Hi

 

Im having some issue here, i know the creating of private channel using microsoft graph is in beta.

So i create a team and then i create a private channel in this team using a HTTP request posting to microsoft graph, everything works as it should and the private channel is created.

 

But the SharePoint site for the private channel is not generated until you actually open the Teams app and go to the private channel and click on the files tab. Then it generates the SharePoint site.

 

I know this was an issue before when creating a Team using the same method.

Please if anyone know how i can trigger a interaction or something so the SharePoint site starts to generate on the private channel in Teams?

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    I will check if I can get our code. And post it

  • BM-HV Profile Picture
    13 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    I have more than 1,500 private channels, each one in an own Teams. I'm calling "/filesfolder" via a PowerShell script against an AAD app registry with application permissions (Group Read/Write All):

    Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken" } -Uri "https://graph.microsoft.com/v1.0/teams/$($team.ObjectId)/channels/$($primaryChannel.id)/filesFolder"

    Result: time-out and no SharePoint site provisioned.

     

    This is the whole script, even though it doesn't help because it seems like calling "/filesfolder" is not triggering SPO site creation.

    $maxRetryCount = 100
    
    #Get the stored credentials from the Windows Credential Store
    $credential = Get-PnPStoredCredential -Name 'MyAADApp'
     
    #Connect to SharePoint Online using clientApp and certificate credentials
    Connect-PnPOnline -Url "https://tenant-admin.sharepoint.com" -ClientId $credential.UserName -Thumbprint $credential.GetNetworkCredential().Password -Tenant "tenant.onmicrosoft.com" -ReturnConnection
     
    #Request graph access toeken
    $accessToken = Get-PnPGraphAccessToken
    
    #Get teams from projects list
    Connect-AzureAD
    $teams = Get-AzureADGroup -All:$true | Where-Object {$_.MailNickname.StartsWith('MyProjectTeams-')}
     
    #Loop through each team
    foreach ($team in $teams) {
     Write-Host $team.DisplayName -ForegroundColor White -BackgroundColor Green
     
     #Capture critical errors on rowlevel
     try {
     
     #Get the primary channel
     $primaryChannel = Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken" } -Uri "https://graph.microsoft.com/v1.0/teams/$($team.ObjectId)/primaryChannel" -Method 'GET' -ContentType 'application/json' | Select-Object 'displayName', 'id'
     $privateChannels = (Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken" } -Uri "https://graph.microsoft.com/v1.0/teams/$($team.ObjectId)/channels?`$filter=membershipType eq `'private`'" -Method 'GET' -ContentType 'application/json').value | Select-Object 'displayName', 'id'
     
     #Trigger private channel SharePoint Onlinesite creation
     Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken" } -Uri "https://graph.microsoft.com/v1.0/teams/$($team.ObjectId)/channels/$($primaryChannel.id)/filesFolder" | Out-Null
     
     Write-Host $privateChannels
     if($privateChannels -ne $null){
     foreach ($privateChannel in $privateChannels) {
     
     #Attempt private channel check
     $stopLoop = $false
     [int]$retryCount = '0'
     
     do {
     try {
     Invoke-RestMethod -Headers @{Authorization = "Bearer $accessToken" } -Uri "https://graph.microsoft.com/v1.0/teams/$($team.ObjectId)/channels/$($privateChannel.id)/filesFolder"
     $stopLoop = $true
     }
     catch {
     if ($retryCount -gt $maxRetryCount) {
     $stoploop = $true
     }
     else {
     
     Start-Sleep -Seconds 5
     $retryCount = $retryCount + 1
     }
     }
     }
     While ($stopLoop -eq $false)
     
     }
     }else{
     Write-Host "No private channel. Create the private channel."
     }
     }
     catch {
     
     Write-Host $_
     
     }
     
    }

     

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    Currently we have a delay set for 30sec after creating the private channel.
    You can also call Documents folder using Microsoft Graph, this would trigger provisioning of the SPO site.

    I believe using Get-filesFolder calling the documents folder of the private channel would trigger the provisioning.
    https://docs.microsoft.com/en-us/graph/api/channel-get-filesfolder?view=graph-rest-1.0&tabs=http

     

    https://github.com/microsoftgraph/microsoft-graph-docs/issues/10206

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    There is a solution to this as we have implemented something like this in one of our solutions, I believe it is using PowerShell. I can check this in Monday and update this post.

  • BM-HV Profile Picture
    13 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    Is there a solution for this? We're facing the same issue: we can't migrate to private channels which we've created via the Graph API in application context as the SharePoint site isn't created.

  • Rodriguez Profile Picture
    12 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    No one?

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    No one?

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    @v-alzhan-msft 

    The issue is like this: https://powerusers.microsoft.com/t5/Building-Flows/Teams-Channel-creation-using-flow-does-not-create-SharePoint/m-p/389437/highlight/false#M44189

     

    Except for private channel the SharePoint site is not generated until you visit the files tab in the private channel. This really creates issues because i can never create folders or anything in that private channel in flow as it will fail because the SharePoint site have not been generated even if the channel is created.

  • JimmyW Profile Picture
    2,563 on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    @v-alzhan-msft Here comes my flow, i have made it as small as possible for test.

    The issue is that the private channel site is never generated until i manually opens teams and visit the channel. So i cant get any data from the private channel except channel id, but not siteID or drive id and so on because they are not generated until you open the channel in Teams for the first time.

     

    I can add that if i post everything in graph explorer it works but creating it using a HTTP in flow to graph will not give the same result.

     

    2020-02-05 14_17_53-.png

     

    If you try to use get list or anything on the private channel it will fail because it's not created. And there is no provisioning time for it it's just created when you open the channel, thats the only trigger i found.

     

    Get list to private channel webURL

    "message": "We didn't find a site with this address. Make sure you are entering the exact address of the site.\r\nclientRequestId:
  • v-alzhan-msft Profile Picture
    on at
    Re: Creating a private channel in HTTP request does not generate sharepoint site

    Hi @JimmyWork ,

     

    Could you please share a screenshot of the configuration of your flow?

     

    Best regards,
    Alice       
     
    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492