Exchange Adapter Actions
  • 16 Aug 2022
  • 9 Minutes to read
  • Dark
    Light

Exchange Adapter Actions

  • Dark
    Light

Article Summary

Exchange Adapter Actions

RapidIdentity Connect Exchange Administration Web Service Agent

The Exchange adapter depends on the Exchange Agent. Access the Exchange/Office 365 Agent Guides to download and install the correct agent.

addExchangeDistributionGroupMember

Add a member to an Exchange Distribution Group.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

groupIdentity*

text, expression, variable

the identity of the Distribution Group

memberIdentity*

text, expression, variable

the identity of the object to add to the DistributionGroup

returnVariable

expression, variable

name of the variable to be assigned to the return value

addExchangeDistributionGroupMember(sessionExch,"idautotestgroup",
"idautotestuser")

createExchangeMoveRequest

Create an Exchange MoveRequest record. (Exchange 2010 or higher)

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

moveRequest = createRecord()
setRecordFieldValue(moveRequest, "Identity", "testuser")
setRecordFieldValue(moveRequest, "TargetDatabase", "db2")
queuedMoveRequest = createExchangeMoveRequest(conn, moveRequest)

deleteExchangeDistributionGroup

Delete an Exchange Distribution Group record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Distribution Group to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleteExchangeDistributionGroup(sessionExch,"idautotestgroup")

deleteExchangeDistributionGroupMember

Delete a member from an Exchange Distribution Group.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

groupIdentity*

text, expression, variable

the identity of the Distribution Group

memberIdentity*

text, expression, variable

the identity of the object to delete from the Distribution Group

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleteExchangeDistributionGroupMember(sessionExch,"idautotestgroup",
"idautotestuser")

deleteExchangeMailbox

Delete an Exchange Mailbox record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Mailbox to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleteExchangeMailbox(sessionExch,"idautotestuser")

deleteExchangeMailContact

Delete an Exchange MailContact record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailContact to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleteExchangeMailContact(sessionExch,"testcontact")

deleteExchangeMailUser

Delete an Exchange MailUser record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailUser to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleteExchangeMailUser(sessionExch,"idautotestmailuser")

deleteExchangeMoveRequest

Delete an Exchange MoveRequest record by Id. (Exchange 2010 or higher)

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MoveRequest to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

# cleanup completed and failed move requests so those mailboxes
can be moved again
# first - get the move requests that have completed
filter = createRecord()
setRecordFieldValue(filter, "Status", "Completed")
completedRequests = getExchangeMoveRequests(sessionExch, filter)
forEach(completedRequest, completedRequests) {
deleteExchangeMoveRequest(conn, completedRequest.identity)
}

disableExchangeDistributionGroup

Disable an Exchange Distribution Group record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Distribution Group to disable

returnVariable

expression, variable

name of the variable to be assigned to the return value

disableExchangeDistributionGroup(sessionExch,"idautotestgroup")

disableExchangeMailbox

Disable an Exchange Mailbox record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Mailbox to disable

returnVariable

expression, variable

name of the variable to be assigned to the return value

disableExchangeMailbox(sessionExch,"idautotestuser")

disableExchangeMailContact

Disable an Exchange MailContact record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailContact to disable

returnVariable

expression, variable

name of the variable to be assigned to the return value

disableExchangeMailContact(sessionExch,"mailcontact")

disableExchangeMailUser

Disable an Exchange MailUser record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailUser to disable

returnVariable

expression, variable

name of the variable to be assigned to the return value

disableExchangeMailUser(sessionExch,"idauttestmailuser")

getExchangeDistributionGroup

Get an Exchange Distribution Group record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Distribution Group to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeDistributionGroup(sessionExch, "idautotestgroup")

getExchangeDistributionGroups

Get Exchange Distribution Group records.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

filter

text, expression, variable

an OPath filter or an example Record

maxResults

expression, variable

maximum number of Records to return (default: 1000)

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeDistributionGroups(sessionExch,exchFilter)

getExchangeMailbox

Get an Exchange Mailbox record by Identity.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange Mailbox to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailbox(sessionExch,"idautotestuser")

getExchangeMailboxes

Get Exchange Mailbox records.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

filter

text, expression, variable

an OPath filter or an example Record

maxResults

expression, variable

maximum number of Records to return (default: 1000)

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailboxes(sessionExch,exchFilter)

getExchangeMailContact

Get an Exchange MailContact record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailContact to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailContact(sessionExch, "idautotestmailuser")

getExchangeMailContacts

Get Exchange MailContact records.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

filter

text, expression, variable

an OPath filter or an example Record

maxResults

expression, variable

maximum number of Records to return (default: 1000)

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailContacts(sessionExch)

getExchangeMailUser

Get an Exchange MailUser record by Id.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MailUser to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailUser(sessionExch,"idautotestmailuser")

getExchangeMailUsers

Get Exchange MailUser records.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

filter

text, expression, variable

an OPath filter or an example Record

maxResults

expression, variable

maximum number of Records to return (default: 1000)

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMailUsers(sessionExch)

getExchangeMoveRequest

Get an Exchange MoveRequest record by Identity.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

identity*

text, expression, variable

the identity of the Exchange MoveRequest to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

getExchangeMoveRequest(sessionExch, "testuser")

getExchangeMoveRequests

Get Exchange MoveRequest records. (Exchange 2010 or higher)

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

filter

text, expression, variable

an example Record

maxResults

expression, variable

maximum number of Records to return (default: 1000)

returnVariable

expression, variable

name of the variable to be assigned to the return value

See deleteExchangeMoveRequest

openExchangeConnection

Open a connection to Exchange.

Property

Value

Description

exchangeServer*

text, expression, variable

the DNS name or IP address of the Exchange server)

dc

text, expression, variable

the domain qualified name of the Active Directory DC to use (default: automatic)

exchangeAgentURL*

text, expression, variable

the URL of the Exchange Administrative Web Service agent (e.g. https://hostname:port/idautoExchangeAdminWS)

username*

text, expression, variable

username for authentication to Exchange

password*

password, string, expression, variable

password for authentication to Exchange

options

expression, variable

A record or JavaScript object with a field for each additional option. Currently defined fields are connectTimeout and socketTime which require a numeric value from 1 to 2147483647 (0x7FFFFFFF) that represents the number of milliseconds for the timeout, and 0 representing no timeout.

returnVariable

expression, variable

name of the variable to be assigned to the return value

Global.ExchURL = "https://10.10.10.10/idautoExchangeAdminWS"
Global.ExchUser = "exchangeadmin@idauto.net"
Global.ExchPwd = Password
Global.ExchServer = "10.10.10.10"
sessionExch = openExchangeConnection(Global.ExchServer,Global.ExchURL,
Global.ExchUser,Password>)

saveExchangeDistributionGroup

Create/Update an Exchange Distribution Group record.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

groupRecord = createRecord()
setRecordFieldValue(groupRecord, "Name","idautotestgroup")
saveExchangeDistributionGroup(sessionExch,groupRecord)

saveExchangeMailbox

Create/Update an Exchange Mailbox record.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

userRecord = createRecord()
setRecordFieldValue(userRecord, "Name","idautotestuser")
setRecordFieldValue(userRecord, "Password",<Password>)
setRecordFieldValue(userRecord, "userPrincipalName",
"idautotestuser@test1.local")
setRecordFieldValue(userRecord, "LastName","user1")
setRecordFieldValue(userRecord, "FirstName","Bob")
saveExchangeMailbox(sessionExch,userRecord)

saveExchangeMailContact

Create/Update an Exchange MailContact record.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

contactRecord = createRecord()
setRecordFieldValue(contactRecord, "Name","testcontact")
setRecordFieldValue(contactRecord, "EmailAddresses",
"testcontact@somewhere.org")
saveExchangeMailContact(sessionExch,contactRecord)

saveExchangeMailUser

Create/Update an Exchange MailUser record.

Property

Value

Description

connection*

expression, variable

the Exchange connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

userRecord2 = createRecord()
setRecordFieldValue(userRecord2, "Name", "testmailuser")
setRecordFieldValue(userRecord2, "EmailAddresses",
"testmailuser@idauto.net")
saveExchangeMailUSer(sessionExch,userRecord2)

Supported Exchange Record Fields

Fields supported for creating/updating on Exchange objects are documented as parameters to the New-* and Set-* Exchange Shell CmdletsBecause many objects are polymorphic, there are different cmdlets that can be applied to the same object and the set of supported attributes is based on all the applicable cmdlets, e.g. a Mailbox is also a User, a Recipient, a CASMailbox, and a MailboxRegionalConfiguration, so the set of supported attributes is the union of the Cmdlets for those 5 object types.

For all record types, the Identity field serves as the identifier for the corresponding Exchange object. On save, a record that has the Identity field will be treated as an update, whereas any record without the Identity field will be treated as a create or enable, depending on whether or not the corresponding object in AD already exists. Records returned from Exchange will always have the Identity field populated, though for purposes of getting or updating the object, any of the following can be used interchangeably as the Identity: ADObjectID, Alias, Distinguished name (DN), Domain\Account, GUID, LegacyExchangeDN, SmtpAddress, or User principal name (UPN).

For search filters, only one Exchange object type is supported for each record type, which means that searches cannot be performed across all the attributes that are supported for create/update on each record type. The list of attributes supported in search filters can be found here: http://technet.microsoft.com/en-us/library/bb738155.aspx. The syntax for searching is called OPath and is documented here: http://technet.microsoft.com/en-us/library/bb124268.aspx#OPATH. Filters should NOT be enclosed in braces { } because the adapter automatically takes care of that.

Record Type

New Cmdlet

Set Cmdslet(s)

Supported Attributes

Search Filter Object Type

Mailbox

New-Mailbox

Set-Mailbox

Set-User

Set-CASUser

Set-MailboxRegionalConfiguration

Set-UserPhoto

AcceptMessagesOnlyFrom, AcceptMessagesOnlyFromDLMembers, AcceptMessagesOnlyFromSendersOrMembers, ActiveSyncAllowedDeviceIDs, ActiveSyncBlockedDeviceIDs, ActiveSyncDebugLogging, ActiveSyncEnabled, ActiveSyncMailboxPolicy, Alias, ApplyMandatoryProperties, AssistantName, BypassModerationFromSendersOrMembers, CalendarRepairDisabled, CalendarVersionStoreDisabled, City, Company, CountryOrRegion, CustomAttribute1, CustomAttribute2, CustomAttribute3, CustomAttribute4, CustomAttribute5, CustomAttribute6, CustomAttribute7, CustomAttribute8, CustomAttribute9, CustomAttribute10, CustomAttribute11, CustomAttribute12, CustomAttribute13, CustomAttribute14, CustomAttribute15, DeliverToMailboxAndForward, Department, Discovery, DisplayName, EmailAddresses, EmailAddressPolicyEnabled, EvictLiveId, ExternalOofOptions, Fax, FederatedIdentity, FirstName, Force, ForwardingAddress, GrantSendOnBehalfTo, HomePhone, Identity, ImapEnabled, ImapMessagesRetrievalMimeFormat, ImapUseProtocolDefaults, ImmutableId, ImportLiveId, Initials, Languages, LastName, MAPIEnabled, MailTip, MailTipTranslations, MailboxPlan, Manager, MessageTrackingReadStatusEnabled, MobilePhone, ModeratedBy, ModerationEnabled, Name, Notes, OWAEnabled, Office, OrganizationalUnit, OtherFax, OtherHomePhone, OtherTelephone, Pager, Password, Phone, PopEnabled, PopMessagesRetrievalMimeFormat, PopUseProtocolDefaults, PostOfficeBox, PostalCode, RejectMessagesFrom, RejectMessagesFromDLMembers, RejectMessagesFromSendersOrMembers, RemotePowerShellEnabled, RemovedMailbox, RequireSenderAuthenticationEnabled, ResetPasswordOnNextLogon, ResourceCapacity, ResourceCustom, SecondaryAddress, SendModerationNotifications, SimpleDisplayName, StateOrProvince, StreetAddress, Title, Type, UseExistingLiveId, UserCertificate, UserSMimeCertificate, WebPage, WindowsEmailAddress, DateFormat, Language, LocalizeDefaultFolderName, TimeFormat, TimeZone, PictureData

Recipient

DistributionGroup

New-DistributionGroup

Set-DistributionGroup

Set-Group

AcceptMessagesOnlyFrom, AcceptMessagesOnlyFromDLMembers, AcceptMessagesOnlyFromSendersOrMembers, Alias, BypassModerationFromSendersOrMembers, BypassNestedModerationEnabled, CopyOwnerToMember, CreateDTMFMap, CustomAttribute1, CustomAttribute2, CustomAttribute3, CustomAttribute4, CustomAttribute5, CustomAttribute6, CustomAttribute7, CustomAttribute8, CustomAttribute9, CustomAttribute10, CustomAttribute11, CustomAttribute12, CustomAttribute13, CustomAttribute14, CustomAttribute15, DisplayName, EmailAddresses, GrantSendOnBehalfTo, HiddenFromAddressListsEnabled, Identity, MailTip, MailTipTranslations, ManagedBy, MemberDepartRestriction, MemberJoinRestriction, Members, ModeratedBy, ModerationEnabled, Name, Notes, OrganizationalUnit, PhoneticDisplayName, PrimarySmtpAddress, RejectMessagesFrom, RejectMessagesFromDLMembers, RejectMessagesFromSendersOrMembers, ReportToManagerEnabled, ReportToOriginatorEnabled, RequireSenderAuthenticationEnabled, RoomList, SendModerationNotifications, SendOofMessageToOriginatorEnabled, SimpleDisplayName, Type, Universal, WindowsEmailAddress

Recipient

MailContact

New-MailContact

Set-MailContact

Set-Contact

AcceptMessagesOnlyFrom, AcceptMessagesOnlyFromDLMembers, AcceptMessagesOnlyFromSendersOrMembers, Alias, AllowUMCallsFromNonUsers, AssistantName, BypassModerationFromSendersOrMembers, City, Company, CountryOrRegion, CreateDTMFMap, CustomAttribute1, CustomAttribute2, CustomAttribute3, CustomAttribute4, CustomAttribute5, CustomAttribute6, CustomAttribute7, CustomAttribute8, CustomAttribute9, CustomAttribute10, CustomAttribute11, CustomAttribute12, CustomAttribute13, CustomAttribute14, CustomAttribute15, Department, DisplayName, EmailAddresses, ExternalEmailAddress, Fax, FirstName, GrantSendOnBehalfTo, HiddenFromAddressListsEnabled, HomePhone, Identity, Initials, LastName, MacAttachmentFormat, MailTip, MailTipTranslations, Manager, MessageBodyFormat, MessageFormat, MobilePhone, ModeratedBy, ModerationEnabled, Name, Notes, Office, OrganizationalUnit, OtherFax, OtherHomePhone, OtherTelephone, Pager, Phone, PhoneticDisplayName, PostOfficeBox, PostalCode, RejectMessagesFrom, RejectMessagesFromDLMembers, RejectMessagesFromSendersOrMembers, RequireSenderAuthenticationEnabled, SecondaryAddress, SecondaryDialPlan, SendModerationNotifications, SimpleDisplayName, StateOrProvince, StreetAddress, TelephoneAssistant, Title, UMCallingLineIds, UMDialPlan, UseMapiRichTextFormat, UsePreferMessageFormat, WebPage, WindowsEmailAddress

Recipient

MailUser

New-MailUser

Set-MailUser

Set-User

Set-CASUser

AcceptMessagesOnlyFrom, AcceptMessagesOnlyFromDLMembers, AcceptMessagesOnlyFromSendersOrMembers, Alias, AllowUMCallsFromNonUsers, AssistantName, BypassModerationFromSendersOrMembers, City, Company, CountryOrRegion, CreateDTMFMap, CustomAttribute1, CustomAttribute2, CustomAttribute3, CustomAttribute4, CustomAttribute5, CustomAttribute6, CustomAttribute7, CustomAttribute8, CustomAttribute9, CustomAttribute10, CustomAttribute11, CustomAttribute12, CustomAttribute13, CustomAttribute14, CustomAttribute15, Department, DisplayName, EmailAddresses, ExternalEmailAddress, Fax, FirstName, GrantSendOnBehalfTo, HiddenFromAddressListsEnabled, HomePhone, Identity, Initials, LastName, MacAttachmentFormat, MailTip, MailTipTranslations, Manager, MessageBodyFormat, MessageFormat, MobilePhone, ModeratedBy, ModerationEnabled, Name, Notes, Office, OrganizationalUnit, OtherFax, OtherHomePhone, OtherTelephone, Pager, Phone, PhoneticDisplayName, PostOfficeBox, PostalCode, RejectMessagesFrom, RejectMessagesFromDLMembers, RejectMessagesFromSendersOrMembers, RequireSenderAuthenticationEnabled, SecondaryAddress, SecondaryDialPlan, SendModerationNotifications, SimpleDisplayName, StateOrProvince, StreetAddress, TelephoneAssistant, Title, UMCallingLineIds, UMDialPlan, UseMapiRichTextFormat, UsePreferMessageFormat, WebPage, WindowsEmailAddress

Recipient

MoveRequest

New-MoveRequest

N/A

Identity, Remote, RemoteCredential, RemoteGlobalCatalog, RemoteHostName, RemoteLegacy, AcceptLargeDataLoss, ArchiveDomain, ArchiveOnly, ArchiveTargetDatabase, BadItemLimit, BatchName, Confirm, DoNotPreserveMailboxSignature, DomainController, IgnoreRuleLimitErrors, MRSServer, PrimaryOnly, Protect, RemoteOrganizationName, RemoteTargetDatabase, Suspend, SuspendComment, SuspendWhenReadyToComplete, TargetDatabase, TargetDeliveryDomain

MoveRequest

Mailbox Moves

Starting in Exchange 2010, you can initiate moving a mailbox from one database to another using createExchangeMoveRequest. There are a lot of different options provided by the cmdlet so make sure you review the Understanding Move Requests in the Exchange documentation to know which properties to set for a particular scenario.

Some scenarios require providing a credential field. A credential field requires two values, the first being the username and the second the password.

Once a move is requested you can track its progress using getExchangeMoveRequest. You can also search for MoveRequests (with optional filter) getExchangeMoveRequests. Note that the optional filter does not support OPath like all the other Exchange object types do and that the criteria in the record used as a filter is limited to the parameters available for the Get-MoveRequest cmdlet.

One thing to keep in mind about MoveRequests is that the MoveRequest has to be deleted once mailbox move has been completed before another MoveRequest can be created for that mailbox. One way to accomplish that would be to create a job that uses getExchangeMoveRequests to get a list of all the existing requests, and then to use deleteExchangeMoveRequest to delete any MoveRequests that have Status “Completed”. You may also want to check for and requests with Statuses “CompletedWithWarning” and “Failed” and send notification to an administrator for remediation. Deleting a MoveRequest that has not yet completed will effectively cancel the move.

The Adapter does not currently support modifying, suspending or resuming an existing MoveRequest.


Was this article helpful?