Command
New-MailboxCopyOptions
Description
This command creates copy options to be used in a mailbox copy operation.
Examples
Copy only emails from the past 90 days
$src = Connect-MicrosoftOnline $dst = Connect-MicrosoftOnline $copyOptions = New-MailboxCopyOptions -IncludeEmails -EmailCopyRangeStart (Get-Date).AddDays(-90) $mailboxesToCopy = Get-Mailbox -Connection $src -Id 272980f8-cba2-4b7f-b020-12ea922d92c5 $mappings = Import-MailboxMappings -SourceConnection $src -DestinationConnection $dst -Path "C:\mappings\SharegateMailboxesMapping.csv" Copy-Mailbox -SourceConnection $src -DestinationConnection $dst -CopyOptions $copyOptions -MappingSettings $mappings -Mailboxes $mailboxesToCopy
Copy emails from a date range and include calendar events with new links
$startDate = [DateTime]::ParseExact("06-01-2024", "MM-dd-yyyy", $null) $endDate = [DateTime]::ParseExact("12-01-2024", "MM-dd-yyyy", $null) New-MailboxCopyOptions -IncludeEmails -EmailCopyRangeStart $startDate -EmailCopyRangeEnd $endDate -IncludeCalendar -CreateNewMeetingLinks
Copy all emails and include mailbox rules
New-MailboxCopyOptions -IncludeEmails -IncludeMailboxRules
Copy only contacts
New-MailboxCopyOptions -IncludeContacts
Copy calendar events with new meeting links, mailbox rules, contacts and emails from the past 180 days
$startDate = (Get-Date).AddDays(-180) New-MailboxCopyOptions -IncludeEmails -EmailCopyRangeStart $startDate -IncludeCalendar -CreateNewMeetingLinks -IncludeContacts -IncludeMailboxRules
Syntax
New-MailboxCopyOptions
[-IncludeEmails <SwitchParameter>]
[-EmailCopyRangeStart <DateTime>]
[-EmailCopyRangeEnd <DateTime>]
[-IncludeCalendar <SwitchParameter>]
[-CreateNewMeetingLinks <SwitchParameter>]
[-IncludeContacts <SwitchParameter>]
[-IncludeMailboxRules <SwitchParameter>]
Parameters
-CreateNewMeetingLinks <SwitchParameter>
Specifies to replace the Team links in the calendar events.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-EmailCopyRangeEnd <DateTime>
Specifies the ending date from which the emails will be migrated.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-EmailCopyRangeStart <DateTime>
Specifies the starting date from which the emails will be migrated.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-IncludeCalendar <SwitchParameter>
Specifies to copy the mailbox calendar.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-IncludeContacts <SwitchParameter>
Specifies to copy the mailbox contacts.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-IncludeEmails <SwitchParameter>
Specifies to migrate the mailbox emails
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-IncludeMailboxRules <SwitchParameter>
Specifies to copy the mailbox rules.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |