Skip to main content
Import-MailboxMappings

Import mailbox and recipient mappings with PowerShell

Updated this week

Command

Import-MailboxMappings

Description

The command to import mailbox mappings from a file.

Note: When you export your mailbox and recipient mappings in the app, they are separated. To combine the mappings you exported from the app for PowerShell, see Combine your mailbox and recipient mappings for PowerShell.

Examples

Import mailbox mappings from a file

# Define the file path for the CSV file containing mailbox mappings
$filePath = "C:\MailboxMappingsToImport.csv"

# Connect to the source Microsoft Online tenant
$sourceConnection = Connect-MicrosoftOnline

# Connect to the destination Microsoft Online tenant
$destinationConnection = Connect-MicrosoftOnline

# Import mailbox mappings from the specified CSV file
Import-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath

Import mailbox mappings from the export mappings command result

# Define the file path for the CSV file to store mailbox mappings
$filePath = "C:\MailboxMappingsToImport.csv"

# Connect to the source Microsoft Online tenant
$sourceConnection = Connect-MicrosoftOnline

# Connect to the destination Microsoft Online tenant
$destinationConnection = Connect-MicrosoftOnline

# Export all mailbox mappings from the source tenant to the destination tenant
# The exported file can be reused for future import commands
Export-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath

# Import mailbox mappings using the previously exported CSV file
Import-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath

Syntax

Import-MailboxMappings
-SourceConnection <Connection>
-DestinationConnection <Connection>
-Path <FileInfo>

Parameters

-DestinationConnection <Connection>

Specifies the destination connection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Path <FileInfo>

Specifies the .csv file path to map the source mailboxes.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-SourceConnection <Connection>

Specifies the source connection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?