Group creation no longer provisioning Planner board

Steel Contributor

We have an automated Group creation process using Microsoft graph and prior to last week, the creation of a Group automatically provisioned the associated SharePoint Site and Planner Board.  This past week, we found that the associated SPO site and Planner board are now longer automatically provisioned when we create the Group via the graph.  Is this by design?  Why the change?

 

It's causing us issues as we have enabled Planner, and folks request a Planner Board/Group and we automate the provisioning of it, however it will no longer automatically create the Planner Board.  We were sending a direct link to the Planner board out to the users.

2 Replies

Thanks Erin.  I can chime in from the SharePoint side, and adding @Eray Chou from Planner.

 

Can you share some details on how you are creating the groups themselves?  You mention you are using graph - can you paste a code snippet please?

 

Alternatively, you can open a support ticket.  Generally speaking, groups created via MS Graph result in the synchronous creation of the SharePoint site.

 

Thanks,

Tejas

$GroupName="NameOfYourGroup"
$upn="someone@somewhere.onmicrosoft.com"
#$upn = $requestBody.upn

$TenantID=Get-AutomationVariable -Name 'TenantID'
$AppID=Get-AutomationVariable -Name 'AppID'
$AppSecret=Get-AutomationVariable -Name 'AppSecret'
# Make email address safe...
$EMail = $GroupName.Trim().Replace(" ","-")

Write-Output "TenantID: $TenantID AppID: $AppID AppSecret: $AppSecret"
Write-Output "GroupName: $GroupName EMail: $EMail UPN: $upn"

function Initialize-Authorization {
param
(
[string]
$ResourceURL = 'https://graph.microsoft.com',

[string]
[parameter(Mandatory)]
$TenantID,

[string]
[Parameter(Mandatory)]
$ClientKey,

[string]
[Parameter(Mandatory)]
$AppID
)

$Authority = "https://login.windows.net/$TenantID/oauth2/token"

[Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null
$EncodedKey = [System.Web.HttpUtility]::UrlEncode($ClientKey)

$body = "grant_type=client_credentials&client_id=$AppID&client_secret=$EncodedKey&resource=$ResourceUrl"

# Request a Token from the graph api
$result = Invoke-RestMethod -Method Post `
-Uri $Authority `
-ContentType 'application/x-www-form-urlencoded' `
-Body $body

$script:APIHeader = @{'Authorization' = "Bearer $($result.access_token)" }
Write-Output $result
}


# Initialize Authorization
Initialize-Authorization -TenantID $TenantID -ClientKey $AppSecret -AppID $AppID


# Check if group is already existing
try {
$uri = "https://graph.microsoft.com/v1.0/groups?`$filter=startswith(mail,'$EMail')"

$result = Invoke-RestMethod -Method Get `
-Uri $uri `
-ContentType 'application/json' `
-Headers $script:APIHeader `

# and save the generated Group ID
$GroupID = $result.value.id
Write-Output "GroupID: $GroupID"
} catch {
Write-Output "ERROR! $_"
}

# If $GroupID is empty...
Write-Output "[$GroupID]"
if ([bool]$GroupID)
{
$msg = "EXISTING: $EMail, $GroupID"
}
else
{
$msg = "CREATED: $EMail, $GroupID"

# Create the Office 365 group
$json = @"
{
"description": "$GroupName",
"displayName": "$GroupName",
"groupTypes": [
"Unified"
],
"mailEnabled" : true,
"mailNickname": "$Email",
"securityEnabled" : false,
"visibility" : "Private",
"classification" : "Unclassified"

}
"@


try {
$result = Invoke-RestMethod -Method Post `
-Uri "https://graph.microsoft.com/beta/groups" `
-ContentType 'application/json' `
-Headers $script:APIHeader `
-Body $json `
-ErrorAction Stop

# and save the generated Group ID
$GroupID = $result.id
Write-Output "GroupID: $GroupID"
} catch {
Write-Output "ERROR! $_"
}

# Get the User ID
try {
$OwnerObject = Invoke-RestMethod -Method Get `
-Uri "https://graph.microsoft.com/v1.0/users/$upn" `
-ContentType 'application/json' `
-Headers $script:APIHeader `
-ErrorAction Stop
Write-Output $OwnerObject.UserPrincipalName
} catch {
Write-Output "ERROR! $_"
}

# Add User as Owner
$json = @"
{ "@odata.id": "https://graph.microsoft.com/v1.0/users/$($OwnerObject.id)" }
"@

try {
$result = Invoke-RestMethod -Method Post `
-Uri "https://graph.microsoft.com/v1.0/groups/$GroupID/owners/`$ref" `
-ContentType 'application/json' `
-Headers $script:APIHeader `
-Body $json `
-ErrorAction Stop
Write-Output "Added owner: $GroupID"
} catch {
Write-Output "ERROR! $_"
}


# add user as Member
try {
$result = Invoke-RestMethod -Method Post `
-Uri "https://graph.microsoft.com/v1.0/groups/$GroupID/members/`$ref" `
-ContentType 'application/json' `
-Headers $script:APIHeader `
-Body $json `
-ErrorAction Stop
Write-Output "Added member: $GroupID"
} catch {
Write-Output "ERROR! $_"
}