Home

Teams Automation - cloning Teams, SharePoint site.

%3CLINGO-SUB%20id%3D%22lingo-sub-1185193%22%20slang%3D%22en-US%22%3ETeams%20Automation%20-%20cloning%20Teams%2C%20SharePoint%20site.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1185193%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20company%20is%20attempting%20to%20automate%20teams%20requests.%20We%20support%205%20different%20teams%20types%20requests%20from%20business%20users.%20Based%20on%20teams%20type%20requested%2C%20we%20do%20specific%20customizations%20to%20Teams%20and%20its%20SharePoint%20site.%20We%20have%205%20such%20teams%20for%20reference%20which%20we%20call%20teams%20templates.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20to%20automate%20teams%20creation%20when%20user%20submits%20a%20request%2C%20I%20am%20using%20a%20Flow%20that%20calls%20Office%20graph%20clone%20API%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fteam-clone%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fapi%2Fteam-clone%3Fview%3Dgraph-rest-1.0%3C%2FA%3E)%20to%20clone%20the%20Teams%20template%20specified%20in%20user%20request.%26nbsp%3BThis%20clone%20call%20(%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2F%257Bteam-id%257D%2Fclone%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%2Fbeta%2Fteams%2F%7Bteam-id%7D%2Fclone%3C%2FA%3E)%20doesn't%20clone%20the%20Teams%20SharePoint%20site%20customizations%20(folders%2C%20features%2C%20permissions%2C%20etc.).%20It%20creates%20uncustomized%26nbsp%3BSharePoint%20site%20for%20newly%20created%20Teams.%20It%20also%20creates%20o365%20group%20for%20newly%20created%20Teams.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20clone%20the%20customizations%20for%20the%20uncustomized%20Teams%20SharePoint%20site%2C%20I%20followed%20the%20following%20process%3A%3C%2FP%3E%3CP%3E1)%20Delete%20the%26nbsp%3Buncustomized%20Teams%20SharePoint%20site.%20It%20also%20deletes%20the%20related%20o365%20group.%3C%2FP%3E%3CP%3E2)%20Recover%20the%20deleted%20o365%20group%20from%20Deleted%20groups%20in%20Admin%20Portal.%3C%2FP%3E%3CP%3E3)%20Go%20to%20Teams%20Template%20SharePoint%20site%26gt%3B%20Site%20Settings%26gt%3B%20'Save%20site%20as%20Template'%20(include%20content).%20It%20creates%20a%20wsp.%20Download%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20Note%3A%20Our%20teams%20template%20sharepoint%20sites%20don't%20have%20Publishing%20features%20enabled.%20Also%20our%20tenant%20allows%20users%20to%20run%20custom%20script%20on%20personal%20sites%20and%20on%20self-service%20created%20sites.%20These%20two%20pre-conditions%20allow%20us%20to%20have%20'Save%20site%20as%20Template'%20option.%3C%2FP%3E%3CP%3E4)%20Create%20a%20new%20SharePoint%20site%20with%20same%20name%20as%20deleted%20site%20in%20SharePoint%20Admin%20Center%26gt%3B%20Active%20Sites%26gt%3B%20Create%26gt%3B%20Other%20Options%20(Templates)%26gt%3B%20More%20templates%26gt%3B%20Custom%26gt%3B%20Select%20Template%20later.%20Fill%20form%20and%20click%20OK.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3BNote%3A%26nbsp%3BInstead%20of%20UI%20option%2C%20we%20can%20also%20'Save%20site%20as%20Template'%20using%20following%20option%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20SharePoint%20PnP%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3BGet-PnPProvisioningTemplate%20-Out%20C%3A%5Ctemp%5Ctemplate.pnp%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20New-PnPTenantSite%20-Url%20'%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2Fsites%2Fpnptempate%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2Fsites%2Fpnptempate%3C%2FA%3E'%20-Title%20'New%20Site%20Collection'%20-Owner%20'admin%40domain.co.uk'%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Connect-PnPOnline%20'%3CA%20href%3D%22https%3A%2F%2Ftenant.sharepoint.com%2Fsites%2Fpnptempate%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftenant.sharepoint.com%2Fsites%2Fpnptempate%3C%2FA%3E'%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Apply-PnPProvisioningTemplate%20-Path%20C%3A%5Ctemp%5Ctemplate.pnp%3C%2FP%3E%3CP%3E5)%20It%20creates%20a%20site.%20You%20can%20see%20it%20under%20classic%20SharePoint%20site%20collections%20list%20as%20well%20as%20in%20Active%20sites%20list.%3C%2FP%3E%3CP%3E6)%20Upload%20the%20wsp%20to%20Solution%20Gallery%20of%20newly%20created%20SharePoint%20site.%20Activate%20solution.%3C%2FP%3E%3CP%3E7)%20Go%20to%20the%20site%20collection%20page%2C%20chose%20the%20wsp%20template%20under%20Custom%20tab%20to%20apply%20template%20to%20site.%20it%20brings%20in%20all%20customizations.%3C%2FP%3E%3CP%3E8)%3C%2Fimg%3E%20Run%20following%20commands%20to%20validate%20that%20the%20Teams%20and%20its%20o365%20group%20are%20correctly%20bound%20to%20new%20SharePoint%20site.%26nbsp%3B%3C%2FP%3E%3CP%3ESet-SPOSiteOffice365Group%20-Site%20https%3A%2F%2F%3CSPAN%3E%7Btenantname%7D%3C%2FSPAN%3E.sharepoint.com%2Fsites%2FTeamEDF1%20-DisplayName%20%22TeamEDF1%22%20-Alias%20%22TeamEDF1%22%3C%2FP%3E%3CP%3E%23%20Reference%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-online%2FSet-SPOSiteOffice365Group%3Fview%3Dsharepoint-ps%26amp%3BviewFallbackFrom%3Dsharepoint-ps.%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-online%2FSet-SPOSiteOffice365Group%3Fview%3D...%3C%2FA%3E%3C%2FP%3E%3CP%3EThe%20commands%20returns%20output%20stating%20the%20site%20is%20already%20connected%20to%20the%20group.%20I%20believe%20it%20is%20because%20the%20site%20name%20and%20group%20name%20(also%20team%20name)%20is%20same.%3C%2FP%3E%3CP%3E9)%20Further%2C%20run%20following%20powershell%20to%20see%20what%20teams%20template%20the%20original%20teams%20template%20sharepoint%20site%20used%20and%20what%20template%20the%20cloned%20sharepoint%20site%20used%3A%3C%2FP%3E%3CP%3EGet-SPOSite%20-Limit%20All%20%7C%20select%20url%2C%20Template%20%7C%20Sort-Object%20Template%2C%20Url%26nbsp%3B%3C%2FP%3E%3CP%3E%23%20Reference%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-online%2Fget-sposite%3Fview%3Dsharepoint-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-online%2Fget-sposite%3Fview%3Dsharepoint-ps%3C%2FA%3E%3C%2FP%3E%3CP%3EBoth%20sites%20show%20same%20template%20'GROUP%230'%3C%2FP%3E%3CP%3E10)%20Furthermore%2C%20the%20files%20uploaded%20in%20Teams%20app%20for%20this%20team%20gets%20uploaded%20in%20cloned%20SharePoint%20site.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20team%20tested%20the%20teams%20and%20found%20it%20working%20well%20but%20pointed%20to%20below%20old%26nbsp%3Barticle%20from%202017%20where%20Vesa%20Juvonen%20(Senior%20Program%20Manager%2C%20SharePoint%20Engineering%2C%20Microsoft)%20mentioned%20not%20to%20use%20'Save%20site%20as%20Template'.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsharepoint%2Fsave-modern-team-site-as-a-template-amp-provision-using-classic%2Fm-p%2F95307%23%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsharepoint%2Fsave-modern-team-site-as-a-template-amp-provision-...%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThey%20wanted%20me%20to%20cross-check%20with%20Teams%20community.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuestions%3A%3C%2FP%3E%3CP%3E1)%20Can%20anyone%20please%20let%20me%20know%20if%20above%20recommendation%20of%20not%20to%20use%20UI%20option%20still%20stand%20correct%20in%202020%20now%20that%203%20years%20have%20passed%20since%20it%20is%20posted%3F%3C%2FP%3E%3CP%3E2)%20Is%20the%20SharePoint%20PnP%20Provisioning%20option%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fpnp-provisioning-framework%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsolution-guidance%2Fpnp-provisioning-framework)%3C%2FA%3E%26nbsp%3Bok%20to%20clone%20Teams%20sharepoint%20site%3F%3C%2FP%3E%3CP%3E3)%26nbsp%3BIs%20my%20whole%20approach%20to%20automating%20teams%20creation%20(cloning%20teams%20%2B%20cloning%20teams%20sharepoint%20site)%20correct%20approach%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20a%20lot%20in%20advance%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESincerely%2C%3C%2FP%3E%3CP%3ERavi%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1185193%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBest%20Practices%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECommunity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Senior Member

Hi,

 

Our company is attempting to automate teams requests. We support 5 different teams types requests from business users. Based on teams type requested, we do specific customizations to Teams and its SharePoint site. We have 5 such teams for reference which we call teams templates.

 

Now, to automate teams creation when user submits a request, I am using a Flow that calls Office graph clone API (https://docs.microsoft.com/en-us/graph/api/team-clone?view=graph-rest-1.0) to clone the Teams template specified in user request. This clone call (https://graph.microsoft.com/beta/teams/{team-id}/clone) doesn't clone the Teams SharePoint site customizations (folders, features, permissions, etc.). It creates uncustomized SharePoint site for newly created Teams. It also creates o365 group for newly created Teams. 

 

To clone the customizations for the uncustomized Teams SharePoint site, I followed the following process:

1) Delete the uncustomized Teams SharePoint site. It also deletes the related o365 group.

2) Recover the deleted o365 group from Deleted groups in Admin Portal.

3) Go to Teams Template SharePoint site> Site Settings> 'Save site as Template' (include content). It creates a wsp. Download it.

    Note: Our teams template sharepoint sites don't have Publishing features enabled. Also our tenant allows users to run custom script on personal sites and on self-service created sites. These two pre-conditions allow us to have 'Save site as Template' option.

4) Create a new SharePoint site with same name as deleted site in SharePoint Admin Center> Active Sites> Create> Other Options (Templates)> More templates> Custom> Select Template later. Fill form and click OK. 

   Note: Instead of UI option, we can also 'Save site as Template' using following option:

        SharePoint PnP:

        Get-PnPProvisioningTemplate -Out C:\temp\template.pnp
        New-PnPTenantSite -Url 'https://tenant.sharepoint.com/sites/pnptempate' -Title 'New Site Collection' -Owner 'admin@domain.co.uk'
        Connect-PnPOnline 'https://tenant.sharepoint.com/sites/pnptempate'
        Apply-PnPProvisioningTemplate -Path C:\temp\template.pnp

5) It creates a site. You can see it under classic SharePoint site collections list as well as in Active sites list.

6) Upload the wsp to Solution Gallery of newly created SharePoint site. Activate solution.

7) Go to the site collection page, chose the wsp template under Custom tab to apply template to site. it brings in all customizations.

8) Run following commands to validate that the Teams and its o365 group are correctly bound to new SharePoint site. 

Set-SPOSiteOffice365Group -Site https://{tenantname}.sharepoint.com/sites/TeamEDF1 -DisplayName "TeamEDF1" -Alias "TeamEDF1"

# Reference: https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/Set-SPOSiteOffice365Group?view=...

The commands returns output stating the site is already connected to the group. I believe it is because the site name and group name (also team name) is same.

9) Further, run following powershell to see what teams template the original teams template sharepoint site used and what template the cloned sharepoint site used:

Get-SPOSite -Limit All | select url, Template | Sort-Object Template, Url 

# Reference: https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/get-sposite?view=sharepoint-ps

Both sites show same template 'GROUP#0'

10) Furthermore, the files uploaded in Teams app for this team gets uploaded in cloned SharePoint site.

 

Our team tested the teams and found it working well but pointed to below old article from 2017 where Vesa Juvonen (Senior Program Manager, SharePoint Engineering, Microsoft) mentioned not to use 'Save site as Template'. 

https://techcommunity.microsoft.com/t5/sharepoint/save-modern-team-site-as-a-template-amp-provision-...

 

They wanted me to cross-check with Teams community.

 

Questions:

1) Can anyone please let me know if above recommendation of not to use UI option still stand correct in 2020 now that 3 years have passed since it is posted?

2) Is the SharePoint PnP Provisioning option (https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/pnp-provisioning-framework) ok to clone Teams sharepoint site?

3) Is my whole approach to automating teams creation (cloning teams + cloning teams sharepoint site) correct approach? 

 

Thanks a lot in advance,

 

Sincerely,

Ravi

Related Conversations
How to install Teams in WVD?
Jgq85 in Windows Virtual Desktop on
0 Replies
Microsoft Forms in Meetings in Teams - wont send
lewisgrimes in Microsoft Forms on
0 Replies
Contacts removed in MS Teams
Ummernayeem in Microsoft Teams on
1 Replies
End user training for Microsoft Teams
pavanverma365 in Enabling Remote Work on
0 Replies