Before using this snippet, verify you've met with the following requirements:
-
The PowerShell EXO v3 module must be installed on the server running the Agent. See instructions
-
User defined variables:
ExchangeOnlineAdminUsername
and$ExchangeOnlineAdminPassword
created in your HelloID portal. See also
This code snippet executes the following tasks:
- Define a hash table
$formObject
. The keys of the hash table represent the properties of theAdd-RecipientPermission
cmdlet, while the values represent the values entered in the form.
To view an example of the form output, please refer to the JSON code pasted below.
{
"MailboxIdentity": "JohnD01@myenvironment.onmicrosoft.com",
"UsersToAdd": [
{
"id": "JaneD01"
},
{
"id": "JohnD02@myenvironment"
},
{
"id": "d55a09fe-b231-XxXx-XxXx-9c369364e991"
}
]
}
❗ It is important to note that the names of your form fields might differ. Ensure that the
$formObject
hashtable is appropriately adjusted to match your form fields. The ID can hold different values See the Microsoft Docs page
-
Constructs a powershell credential object from the supplied administrative username and password
-
Connects with the credentials to the Exchange online environment by means of the
Connect-ExchangeOnline
cmdlet -
Calls the
Add-RecipientPermission
cmdlet to add Send-As permissions to a recipient -
Disconnects from the Exchange environment by means of the
Disconnect-ExchangeOnline
cmdlet