Skip to main content
Import Document
Updated this week

Command

Import-Document

Description

The command to import documents to a SharePoint library.

Tips:

Index

Examples

Import All Documents Pre-Check

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -SourceFolder "\\mysharedrive\documentsToImport\" -DestinationList $dstList -WhatIf

Import All Documents

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -SourceFolder "\\mysharedrive\documentsToImport\" -DestinationList $dstList

Import Documents with a Property Template

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -SourceFolder "\\mysharedrive\documentsToImport\" -DestinationList $dstList -TemplateName "mypropertytemplate"

Specify Folder

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -SourceFolder "\\mysharedrive\documentsToImport\" -DestinationList $dstList -DestinationFolder "MyFolder/MySubFolder"

Note: Using -SourceFolder will migrate the content of your folder, but not the folder itself. To migrate your folder and its content instead, you can use -SourceFilePath. See the example below.

Specify File Paths to Copy

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -DestinationList $dstList -SourceFilePath "\\mysharedrive\documentsToImport\Document1.txt","\\mysharedrive\Folder\Document2.txt"

Note: -SourceFilePath can be a file or folder.

Specify File Paths to Copy (to Destination Folder)

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -DestinationList $dstList -SourceFilePath "\\mysharedrive\documentsToImport\Document1.txt","\\mysharedrive\Folder\Document2.txt" -DestinationFolder "MyDestinationFolder"

Import Documents with Excel

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$dstList = Get-List -Name "mydstlib" -Site $dstSite
Import-Document -DestinationList $dstList -ExcelFilePath "c:\Users\myUser\Desktop\myExcelFile.xslx"

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

Syntax

Import-Document-DestinationList <List>-SourceFolder <Uri>[-TemplateName <String>][-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Import-Document-DestinationList <List>-SourceFolder <Uri>-Template <PropertyTemplate>[-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Import-Document-DestinationList <List>-Template <PropertyTemplate>-SourceFilePath <Uri[]>[-SourceFolder <Uri>][-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Import-Document-DestinationList <List>-SourceFilePath <Uri[]>[-SourceFolder <Uri>][-TemplateName <String>][-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Import-Document-DestinationList <List>-ExcelFilePath <String>[-TemplateName <String>][-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Import-Document-DestinationList <List>-Template <PropertyTemplate>-ExcelFilePath <String>[-DestinationFolder <Uri>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>][-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]

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?

True (ByValue, ByPropertyName)

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.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

TemplateSourceFilePath, TemplateNameSourceFilePath

Aliases

None

-SourceFolder <Uri>

Specifies the folder path at the source.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, Template, TemplateSourceFilePath, TemplateNameSourceFilePath

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, TemplateSourceFilePath, TemplateExcelFilePath

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, TemplateNameSourceFilePath, TemplateNameExcelFilePath

Aliases

None

-WaitForImportCompletion <SwitchParameter>

Specifies that ShareGate Migrate will wait for the Microsoft 365 import from Azure 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 will be 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?