SOLVED

Copy from SP to Teams SP site using Powershell

Copper 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 (Copper 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
1 best response

Accepted Solutions
best response confirmed by Steve Canvin (Copper 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...

 

View solution in original post