SOLVED

Copy from SP to Teams SP site using Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-1702027%22%20slang%3D%22en-US%22%3ECopy%20from%20SP%20to%20Teams%20SP%20site%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1702027%22%20slang%3D%22en-US%22%3E%3CP%3EApologies%20if%20this%20needs%20to%20go%20in%20a%20Teams%20or%20Powershell%20forum%2C%20but%20i%20thought%20id%20try%20here%20first!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20powershell%20script%20using%3A%3C%2FP%3E%3CP%3EConnect-AzAccount%3CBR%20%2F%3EConnect-MicrosoftTeams%2C%3C%2FP%3E%3CP%3E%3CSPAN%3EAzureADPreview%5CConnect-AzureAD%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAs%20part%20of%20creating%20the%20new%20Teams%20we%20would%20like%20to%20prepopulate%20the%20attached%20SharePoint%20site%20with%20a%20copy%20of%20some%20document%20from%20a%20SharePoint%20online%20site.%26nbsp%3B%20Does%20anyone%20have%20any%20knowledge%20or%20pointers%20on%20doing%20this%3F%20Can%20this%20be%20done%20with%20the%20above%20modules%20or%20with%20the%20connect-pnponline.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIve%20looked%20at%20PnP%20copy-pnpfile%20but%20im%20not%20sure%20if%20it%20can%20copy%20to%20a%20Teams%20site%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Echeers%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1702027%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1703847%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20from%20SP%20to%20Teams%20SP%20site%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1703847%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F36609%22%20target%3D%22_blank%22%3E%40Steve%20Canvin%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20use%20Copy-PnPFile%20to%20copy%20files%20and%20folders%20between%20sites%20collections.%3C%2FP%3E%3CP%3ESharePoint%20site%20behind%20a%20team%20is%20a%20SharePoint%20team%20site%2C%20so%20you%20can%20use%20that%20as%20a%20target.%3C%2FP%3E%3CP%3ENotice%20that%20currently%20there%20is%20a%20200MB%20file%20size%20limit%20per%20operation.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-pnp%2Fcopy-pnpfile%3Fview%3Dsharepoint-ps%26amp%3BWT.mc_id%3DM365-MVP-5003860%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fsharepoint-pnp%2Fcopy-pnpfile%3Fview%3Dsharepoint-ps%26amp%3BWT.mc_id%3DM365-MVP-5003860%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Apologies if this needs to go in a Teams or Powershell forum, but i thought id try here first!

 

I have a powershell script using:

Connect-AzAccount
Connect-MicrosoftTeams,

AzureADPreview\Connect-AzureAD

 

As part of creating the new Teams we would like to prepopulate the attached SharePoint site with a copy of some document from a SharePoint online site.  Does anyone have any knowledge or pointers on doing this? Can this be done with the above modules or with the connect-pnponline.

 

Ive looked at PnP copy-pnpfile but im not sure if it can copy to a Teams site? 

 

cheers

3 Replies
best response confirmed by Steve Canvin (Occasional Contributor)
Solution

Hi @Steve Canvin ,

 

You can use Copy-PnPFile to copy files and folders between sites collections.

SharePoint site behind a team is a SharePoint team site, so you can use that as a target.

Notice that currently there is a 200MB file size limit per operation.

https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/copy-pnpfile?view=sharepoint-ps&WT...

 

@Matti Paukkonen Thanks.  Im trying to copy a file from one file to anther in the same library for some testing and get:

Copy-PnPFile : File Not Found.

 

Ive read online that there is a bug with this feature, do you know if this is the case?

Ignore - ive sorted this now :) thanks for your help