FunctionsPublic/New-GraphFolderInGroup.ps1
function New-GraphFolderInGroup { param([psobject]$accessToken, [string]$groupID, [string]$parentItemID, [string]$folderName) # # Create new unified group # $sendBody = @{ "name" = "$($folderName)"; "folder" = @{} } | ConvertTo-Json $sendBody $responseBody = Invoke-RestMethod ` -Uri "https://graph.microsoft.com/v1.0/groups/$($groupID)/drive/items/$($parentItemID)/children" ` -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} ` -Body $sendBody ` -ContentType "application/json" ` -Method POST if($null -eq $responseBody) { return $null } else { return $responseBody } } |