Skip to main content
Copy Content
Updated this week

Command

Copy-Content

Description

The command to copy content from a SharePoint list or library to another.

Tips:

Index

Examples

Copy All Content

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrclist" -Site $srcSite
$dstList = Get-List -Name "mydstlist" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList

Copy Content from Source View

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Site $srcSite -Name "mysrclist"
$dstList = Get-List -Site $dstSite -Name "mydstlist"
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceView "My View"

Copy Content with a Property Template

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Site $srcSite -Name "mysrclist"
$dstList = Get-List -Site $dstSite -Name "mydstlist"
Copy-Content -SourceList $srcList -DestinationList $dstList -TemplateName "mypropertytemplate"

Note: This example uses a template that was already created for your source and destination, and calls it by name. To learn how to define a new template in PowerShell, see New Property Template.

Specify Folder to Copy from

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlist" -Site $dstSite
$srcList = Get-List -Name "mysrclist" -Site $srcSite
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceFolder "MyFolder" -DestinationFolder "MyFolder/MySubFolder"

Note: To migrate a folder and its content, use the Specify File Path to Copy example below instead.

Copy Content with Excel

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrclist" -Site $srcSite
$dstList = Get-List -Name "mydstlist" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -ExcelFilePath "c:\Users\myUser\Desktop\myExcelFile.xslx"

Note: Use this example to copy your content based on an Excel spreadsheet.

Specify File Paths to Copy

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrcLib" -Site $srcSite
$dstList = Get-List -Name "mydstLib" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceFilePath "Document1.txt","Folder/Document2.txt"

Note: -SourceFilePath can be a file, folder or document set. The path is always relative to the library you specify in your script.

Specify File Paths to Copy (to Destination Folder)

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrcLib" -Site $srcSite
$dstList = Get-List -Name "mydstLib" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceFilePath "Document1.txt","Folder/Document2.txt" -DestinationFolder "MyDestinationFolder"

Specify IDs to Copy

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrcList" -Site $srcSite
$dstList = Get-List -Name "mydstList" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceItemId 2,6,100

Specify IDs to Copy (to Destination Folder)

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrcList" -Site $srcSite
$dstList = Get-List -Name "mydstList" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -SourceItemId 2,6,100 -DestinationFolder "MyDestinationFolder"

Copy All Content Pre-Check

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcList = Get-List -Name "mysrclist" -Site $srcSite
$dstList = Get-List -Name "mydstlist" -Site $dstSite
Copy-Content -SourceList $srcList -DestinationList $dstList -WhatIf

Syntax

These are sets of compatible parameters for the Copy-Content command.

Copy-Content-SourceList <List>
-DestinationList <List>
[-TemplateName <String>]
[-SourceView <String>]
[-SourceFolder <Uri>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-SourceList <List>
-DestinationList <List>
-ExcelFilePath <String>
[-TemplateName <String>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-SourceList <List>
-DestinationList <List>
-SourceFilePath <Uri[]>
[-TemplateName <String>]
[-SourceFolder <Uri>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-SourceList <List>
-SourceItemId <Int32[]>
-DestinationList <List>
[-TemplateName <String>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-Template <PropertyTemplate>
-SourceList <List>
-DestinationList <List>
[-SourceView <String>]
[-SourceFolder <Uri>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-Template <PropertyTemplate>
-SourceList <List>
-DestinationList <List>
-ExcelFilePath <String>
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-Template <PropertyTemplate>
-SourceList <List>
-DestinationList <List>
-SourceFilePath <Uri[]>
[-SourceFolder <Uri>]
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]
Copy-Content-Template <PropertyTemplate>
-SourceList <List>
-SourceItemId <Int32[]>
-DestinationList <List>
[-DestinationFolder <Uri>]
[-NormalMode <SwitchParameter>]
[-WaitForImportCompletion <SwitchParameter>]
[-WhatIf <SwitchParameter>]
[-CopySettings <CopySettings>]
[-MappingSettings <MappingSettings>]
[-TaskName <String>]

You can get the syntax of any command in PowerShell with this script:

Get-Command Copy-Site -SyntaxParameters

Parameters

-CopySettings <CopySettings>

Specifies the copy settings.

Required?

False

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-DestinationFolder <Uri>

Specifies the folder path at the destination. Note: This parameter cannot be used to create new folders at the destination.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-DestinationList <List>

Specifies the destination list.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-ExcelFilePath <String>

Specifies the path of the file used for metadata. Supported formats are Excel and CSV.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

TemplateNameExcelFilePath, TemplateExcelFilePath

Aliases

None

-MappingSettings <MappingSettings>

Specifies the mapping settings.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-NormalMode <SwitchParameter>

Specifies that the normal mode should be used.
โ€‹Note: Insane mode is always used by default in PowerShell.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-SourceFilePath <Uri[]>

Specifies the source file path. -SourceFilePath will not work for more than 155 file paths.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

TemplateNameSourceFilePath, TemplateSourceFilePath

Aliases

None

-SourceFolder <Uri>

Specifies the folder path at the source.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, TemplateNameSourceFilePath, Template, TemplateSourceFilePath

Aliases

None

-SourceItemId <Int32[]>

Specifies the source item id.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

TemplateNameSourceItemId, TemplateSourceItemId

Aliases

None

-SourceList <List>

Specifies the source list.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-SourceView <String>

Specifies the source view, using the title, the file name or the URL of the view.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, Template

Aliases

None

-TaskName <String>

Specifies a name for the task.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Template <PropertyTemplate>

Specifies the property template. To use the built-in "Full Copy" template, do not specify this parameter.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Template, TemplateExcelFilePath, TemplateSourceFilePath, TemplateSourceItemId

Aliases

None

-TemplateName <String>

Specifies the property template to use by its name. You can use Sharegate to configure property templates for the specified list (see Import Property Mapping or New Property Template). To use the built-in "Full Copy" template, do not specify this parameter.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, TemplateNameExcelFilePath, TemplateNameSourceFilePath, TemplateNameSourceItemId

Aliases

None

-WaitForImportCompletion <SwitchParameter>

Specifies that the command will wait for azure insane mode import to be completed.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-WhatIf <SwitchParameter>

Specifies that a pre-check is executed instead of a migration. For more information, see Run a Pre-Check in PowerShell.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?