Skip to main content
New-CopySettings

Define your operation mode for content that already exists in the destination with PowerShell

Updated over a week ago

Command

New-CopySettings

Description

The command to change the operation mode to determine how ShareGate Migrate should handle content that already exists at the destination for a SharePoint migration.

You can also determine how you want ShareGate Migrate to handle items that get an error or warning.

Tip: If you want information about other copy options, see Copy options in PowerShell.

Examples

Incremental Copy

$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate 
$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 -CopySettings $copysettings  

Copy List with Custom Copy Settings

$copysettings = New-CopySettings -OnError Cancel -OnWarning Cancel -OnContentItemExists Skip -OnSiteObjectExists Skip -VersionOrModerationComment "Moderate by migration" 
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
Copy-List -All -SourceSite $srcSite -DestinationSite $dstSite -CopySettings $copysettings  

Syntax

New-CopySettings[[-OnWarning] <OnWarningAction {Continue | Cancel}>]
[[-OnError] <OnErrorAction {Skip | SkipAllVersions | Cancel}>]
[[-OnSiteObjectExists] <OnSiteObjectExistsAction {Merge | Skip}>]
[[-OnContentItemExists] <OnContentItemExistsAction {Overwrite | Skip | Rename | IncrementalUpdate}>]
[[-VersionOrModerationComment] <String>]

Parameters

-OnContentItemExists <OnContentItemExistsAction>

Specifies the content item exists automation action.

Required?

False

Default value

Overwrite

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-OnError <OnErrorAction>

Specifies the error automation action.

Required?

False

Default value

Skip

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-OnSiteObjectExists <OnSiteObjectExistsAction>

Specifies the site object exists automation action.

Required?

False

Default value

Merge

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-OnWarning <OnWarningAction>

Specifies the warning automation action.

Required?

False

Default value

Continue

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-VersionOrModerationComment <String>

Specifies the version or moderation comment automation action.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?