IAdmExchangeRemoteMailboxOps
The IAdmExchangeRemoteMailboxOps interface allows enabling and disabling remote mailboxes.
Inheritance: IUnknown
The IAdmExchangeRemoteMailboxOps 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.
Methods
-
Method
-
Description
-
HasRemoteMailbox()
-
Checks whether the user has a remote mailbox.
-
EnableRemoteMailbox()
-
Enables a remote mailbox for the user.
-
EnableRemoteMailboxEx()
-
Enables a remote mailbox for the user. This method extends the
EnableRemoteMailbox
method. -
DisableRemoteMailbox()
-
Disables the remote mailbox of the user.
Details
HasRemoteMailbox()
Checks whether the user has a remote mailbox.
bool HasRemoteMailbox()
EnableRemoteMailbox()
Enables a remote mailbox for the user.
void EnableRemoteMailbox(string remoteRoutingAddress)
Parameters
The remoteRoutingAddress parameter specifies the SMTP address of the remote mailbox in Microsoft 365 (e.g. username@mycompany.mail.onmicrosoft.com). If you set the parameter to null
an address will be generated automatically by Exchange.
Examples
The following code sample enables a remote mailbox using the $Context.TargetObject property.
$remoteRoutingAddress = "john.smith@mycompany.mail.onmicrosoft.com"
$Context.TargetObject.EnableRemoteMailbox($remoteRoutingAddress)
EnableRemoteMailboxEx()
Enables a remote mailbox for the user. This method extends the EnableRemoteMailbox
method with the ability to specify the alias and the primary SMTP address of the mail user that represents the mailbox in your on-premises organization. Also, the method can be used to create remote mailbox archives and remote mailboxes for rooms and equipment.
void EnableRemoteMailboxEx(string remoteRoutingAddress,
string alias,
bool equipment,
bool room,
bool archive,
string archiveName,
string primarySmtpAddress)
Parameters
- remoteRoutingAddress - Specifies the SMTP address of the remote mailbox in Microsoft 365 (e.g. username@mycompany.mail.onmicrosoft.com). If you set the parameter to
null
, an address will be generated automatically by Exchange. - alias - Specifies an email alias for the mailbox. An alias can contain characters from A to Z (uppercase or lowercase), digits from 0 to 9, !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, } or ~. If the parameter is set to
null
, an alias will be generated automatically. - equipment - When set to
true
, the method creates an equipment mailbox. - room - When set to
true
, the method creates a room mailbox. - archive - When set to
true
, the method creates a mailbox archive mailbox. This parameter can only be used if theremoteRoutingAddress
parameter is set tonull
, in other words, if a user already has a remote mailbox. - archiveName - Specifies a name for the mailbox archive. If the archive name is set to
null
, it will be generated automatically by Exchange. The parameter is taken into account only if thearchive
parameter is set totrue
. - primarySmtpAddress - Specifies a primary SMTP address for the mail user that represents the mailbox in your on-premises Exchange organization. If it is set to
null
, the address will be generated automatically based on the default address policy of the Exchange organization.
Examples
The following code sample enables a remote room mailbox using the $Context.TargetObject property.
$routingAddress = "room1@mycompany.mail.onmicrosoft.com"
$alias = "MeetingRoomOnGroundFloor"
$roomMailbox = $true
$equipmentMailbox = $false
$mailboxArchive = $false
$archiveName = $null
$Context.TargetObject.EnableRemoteMailboxEx($routingAddress, $alias, `
$equipmentMailbox, $roomMailbox, $mailboxArchive, $null, $null)
DisableRemoteMailbox()
Disables the remote mailbox of the user.
void DisableRemoteMailbox()
Requirements
Minimum required version: 2016