Skip to content

IAdmMoveExchangeMailboxOps2

The IAdmMoveExchangeMailboxOps2 interface provides methods for moving user mailboxes between on-premises Exchange and Microsoft 365.

Inheritance: The IAdmMoveExchangeMailboxOps2 interface inherits from the IAdmMoveExchangeMailboxOps interface.

Note

To enable remote move migrations, you need to have an externally accessible Exchange server with configured Client Access role and the Mailbox Replication Service Proxy (MRSProxy) service running.

Tip

The IAdmMoveExchangeMailboxOps2 interface is available on the server side only. Thus, methods of the interface can be used only in scripts executed via Business Rules, Custom Commands, and Scheduled Tasks.

Note

To move mailboxes within on-premises Exchange, use the IAdmMoveExchangeMailboxOps interface.

Methods

Details

CreateMoveMailboxToO365Request()

Creates a request for moving a user mailbox from on-premises Exchange to Microsoft 365. The method moves mailboxes asynchronously, meaning that its call will return before the mailbox move is complete.

void CreateMoveMailboxToO365Request(String mrsProxyHostName,
                                    String targetDeliveryDomain,
                                    Int32 badItemLimit, 
                                    Int32 largeItemLimit)

Parameters

  • mrsProxyHostName - Specifies the complete domain name of an externally accessible on-premises Exchange server that facilitates remote move migrations between Microsoft 365 and local Exchange. The on-premises Exchange server should have the Client Access role configured and the Mailbox Replication Service Proxy (MRSProxy) service running.
  • targetDeliveryDomain - Specifies the name of a Microsoft 365 domain used for mail routing. After a mailbox is moved, the user becomes mail-enabled in local Exchange, and their mail is routed to the specified Microsoft 365 domain.
  • badItemLimit - Specifies the maximum number of bad items that are allowed before the request fails. A bad item is a corrupt item in the source mailbox that can’t be copied to the target mailbox. Use 0 to not skip bad items. The valid input range for this parameter is from 0 through 2147483647.
  • largeItemLimit - Specifies the number of large items to skip if the request encounters such items in the mailbox. A large item is a message in the source mailbox that exceeds the maximum message size that’s allowed in the target mailbox. Use 0 to not skip any large items.

Examples

The following code sample moves a local mailbox to Microsoft 365.

$Context.TargetObject.CreateMoveMailboxToO365Request("mail.mycompany.com", "mycompany.mail.onmicrosoft.com", 0, 0)

CreateMoveMailboxFromO365Request()

Creates a request for moving a user mailbox from Microsoft 365 to on-premises Exchange. The method moves mailboxes asynchronously, meaning that its call will return before the mailbox move is complete.

void CreateMoveMailboxFromO365Request(String remoteTargetDatabase, 
                                      String mrsProxyHostName, 
                                      String targetDeliveryDomain, 
                                      Int32 badItemLimit, 
                                      Int32 largeItemLimit)

Parameters

  • remoteTargetDatabase - Specifies the name of the database in the on-premises Exchange server to move the mailbox to.
  • mrsProxyHostName - Specifies the complete domain name of an externally accessible on-premises Exchange server that facilitates remote move migrations between Microsoft 365 and local Exchange. The on-premises Exchange server should have the Client Access role configured and the Mailbox Replication Service Proxy (MRSProxy) service running.
  • targetDeliveryDomain - Specifies the on-premises target delivery domain. After a mailbox is moved, the user becomes mail-enabled in Microsoft 365, and their mail is routed to the specified domain.
  • badItemLimit - Specifies the maximum number of bad items that are allowed before the request fails. A bad item is a corrupt item in the source mailbox that can’t be copied to the target mailbox. Use 0 to not skip bad items. The valid input range for this parameter is from 0 through 2147483647.
  • largeItemLimit - Specifies the number of large items to skip if the request encounters such items in the mailbox. A large item is a message in the source mailbox that exceeds the maximum message size that’s allowed in the target mailbox. Use 0 to not skip any large items.

Examples

The following code sample moves a mailbox from Microsoft 365 to on-premises Exchange.

$Context.TargetObject.CreateMoveMailboxFromO365Request("Mailbox Database 1", "mail.mycompany.com", "mycompany.com", 0, 0)

Requirements

Minimum required version: 2014.1

See also