Forum Discussion
Team Creation with Graph API not creating SharePoint site
- May 17, 2021
Shane_Blake Hi - thanks for reply. I actually raised a PS call in the end, and it turned out to be a problem that Microsoft had to fix at the back end - related to creating the SharePoint site on the time. I think it was a timing issue.
It wasnt fixed as part of my call, sounds like it was being fixed anyway.
I did read about the direct members - i add them now as part of my code anyway so we dont have just an owner without being a member. But it doesnt seem to effect anything for me if they are just owners - the site creation is all via Graph anyway so it doesnt care.
Im using AD groups (on prem) and have a sync framework to manage membership - it fits in with our onboarding processes so we can assign Teams to departments / functions using AD Attributes, and the AD groups add 'exceptions' ie someone from department A wants to join the department B team, we drop them in the Exceptions AD group for the Department B team and the script does the rest. Ideal for Service Desk / integration into a JLT process. Decided to avoid cmdlets and do purely RESTAPI as ive hit so many issues with bugs.
Cheers
However you can do a workaround
- after team creation
- retrieve the SharePoint Site information connected to the team
- retrieve the document library info (drive info: $targetDriveIDURI = "https://graph.microsoft.com/v1.0/groups/" + $teamID + "/drive" )
- knowing you channel name create a dummy file in the channel (yes, the channel folder doesn't exist but it is created during this process)
$createfileURI = "https://graph.microsoft.com/v1.0/drives/" + $targetDriveID +"/root:/" + $channel.displayName +"/dummy_remove.txt:/content"
$fileResponse = Invoke-RestMethod -Method Put -Uri $createfileURI -Headers @{"Authorization"="Bearer $accessToken"} -Body $createfileContent -ContentType "text/plain"
After that you have the folder available for further use.
Note: this doesn't work in Private channels. For those there is a need to wait or click in the UI.