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.
Examples
Create Property Template to Copy Content
$startDate = [DateTime]::ParseExact("01-01-2012", "MM-dd-yyyy", $null) $endDate = [DateTime]::ParseExact("12-31-2012", "MM-dd-yyyy", $null) $propertyTemplate = New-PropertyTemplate -AuthorsAndTimestamps -VersionHistory -Permissions -WebParts -NoLinkCorrection -FlattenFolders -VersionLimit 5 -CheckInAs Publish -ContentApproval SameAsCurrent -From $startDate -To $endDate $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. Use a comma (,) to split multiple extensions.
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. Use a comma (,) to split multiple extensions.
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 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 |