Command
New-PropertyTemplate
Description
The command to create a property template to copy data to a SharePoint list or a library.
Note: New-PropertyTemplate can only be used with content migration commands Import-Document, Copy-Content, Import-BoxDocument, and Import-GoogleDriveDocument.
Index
Examples
Create Property Template to Copy Content
$propertyTemplate = New-PropertyTemplate -AuthorsAndTimestamps -VersionHistory -Permissions -WebParts -NoLinkCorrection -VersionLimit 5 -From "2012-01-01" -To "2012-12-31" $srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $srcList = Get-List -Site $srcSite -Name "mysrclist" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" $dstList = Get-List -Site $dstSite -Name "mydstlist" Copy-Content -SourceList $srcList -DestinationList $dstList -Template $propertyTemplate
Note: When you define a Property template in your script, you have to list everything you need to preserve. In the example above, you are keeping authors and timestamps, version history, permissions, and web parts.
Syntax
These are sets of compatible parameters for the New-PropertyTemplate command.
New-PropertyTemplate [-CheckInAs <CheckInAsType {SameAsCurrent | Publish | Draft}>]
[-ContentApproval <ContentApprovalType {Ignore | SameAsCurrent | Approved | Rejected | Pending | Draft | Scheduled}>] [-AuthorsAndTimestamps <SwitchParameter>]
[-VersionHistory <SwitchParameter>] [-Permissions <SwitchParameter>]
[-WebParts <SwitchParameter>] [-NoLinkCorrection <SwitchParameter>]
[-FlattenFolders <SwitchParameter>] [-VersionLimit <Int32>]
[-From <DateTime>] [-To <DateTime>]
[-UserAlerts <SwitchParameter>]
New-PropertyTemplate [-CheckInAs <CheckInAsType {SameAsCurrent | Publish | Draft}>]
[-ContentApproval <ContentApprovalType {Ignore | SameAsCurrent | Approved | Rejected | Pending | Draft | Scheduled}>] [-AuthorsAndTimestamps <SwitchParameter>]
[-VersionHistory <SwitchParameter>] [-Permissions <SwitchParameter>]
[-WebParts <SwitchParameter>] [-NoLinkCorrection <SwitchParameter>]
[-FlattenFolders <SwitchParameter>] [-VersionLimit <Int32>]
[-From <DateTime>] [-To <DateTime>]
[-UserAlerts <SwitchParameter>] [-LimitToFileExtension <String[]>]
New-PropertyTemplate [-CheckInAs <CheckInAsType {SameAsCurrent | Publish | Draft}>]
[-ContentApproval <ContentApprovalType {Ignore | SameAsCurrent | Approved | Rejected | Pending | Draft | Scheduled}>] [-AuthorsAndTimestamps <SwitchParameter>]
[-VersionHistory <SwitchParameter>] [-Permissions <SwitchParameter>]
[-WebParts <SwitchParameter>] [-NoLinkCorrection <SwitchParameter>]
[-FlattenFolders <SwitchParameter>] [-VersionLimit <Int32>]
[-From <DateTime>] [-To <DateTime>]
[-UserAlerts <SwitchParameter>] [-ExcludeFileExtension <String[]>]
You can get the syntax of any command in PowerShell with this script:
Get-Command New-PropertyTemplate -Syntax
Parameters
-AuthorsAndTimestamps <SwitchParameter>
Specifies if you are preserving the metadata values for Created By, Created, Modified By, and Modified.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-CheckInAs <CheckInAsType>
Specifies the Checked-In value for documents. You can check in your documents as drafts, published versions, or keep the same value as the source. It will only work if the destination document library supports versioning.
Required? | False |
Default value | SameAsCurrent |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-ContentApproval <ContentApprovalType>
Specifies the approval status value for items and documents. It will only work if the destination list supports Content Approval.
Required? | False |
Default value | Ignore |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-ExcludeFileExtension <String[]>
Specifies which file extensions to ignore while copying. You can split multiple extensions with commas.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | ExcludeFileExtension |
Aliases | None |
-FlattenFolders <SwitchParameter>
Specifies that your folder hierarchy is flattened (all your documents are migrated without folders in a flat structure).
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-From <DateTime>
Specifies from which date the data is migrated based on Last Modified Date and Created Date.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-LimitToFileExtension <String[]>
Specifies which file extensions to include. You can split multiple extensions with commas.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | LimitToFileExtension |
Aliases | None |
-NoLinkCorrection <SwitchParameter>
Specifies that links are not be corrected.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Permissions <SwitchParameter>
Specifies that item-level permissions are preserved.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-To <DateTime>
Specifies to which date the data is migrated based on Last Modified Date and Created Date.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-UserAlerts <SwitchParameter>
Specifies that User Alerts are preserved.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-VersionHistory <SwitchParameter>
Specifies that version history will be preserved. It will only work if versioning is enabled on the destination list or library. If the destination only allows for major versions, only the source major versions are copied.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-VersionLimit <Int32>
Specifies the number of versions to copy, while always conserving at least one Major version.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-WebParts <SwitchParameter>
Specifies that WebParts are preserved.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
Comments
4 comments
What are the parameters for -Permissions? I tried False and No, but no luck. How do I prevent permissions from being migrated from a file share migration using PowerShell? I can uncheck the box in the gui, but no luck in PS as it give an error with -Permissions False or -Permissions No.
Hello Demetris,
I went ahead and created a ticket with our Support team to answer your question. You'll be in great hands!
Thanks!
I dont understant the parameter "VersionLimit". If I use the value "3" for exemple, does it keep 3 majors and 3 minors, only 3 majors and all minors?
Hello Charles,
Thank you for your question! It takes your version settings under consideration. It's the last five versions including major and minor versions.
You can find more information on this in Copy Options.
Please sign in to leave a comment.