Microsoft Exchange Online and multi-property values: PowerShell
Many people are familiar with the Exchange Online Management PowerShell module and how cmdlets or parameters are structured. There are some differences in how the module sends its commands and how the Exchange Admin API does them.
One key example is when people grant send on behalf
permissions.
Here's an example of a PowerShell Command:
/Set-Mailbox -Identity [email protected] -GrantSendOnBehalfTo pedro
This will set the SendOnBehalf
permission for the mailbox seanc
to be the user pedro
. However, in some scenarios, it is necessary to grant multiple people access to the mailbox. Re-running the same command above will overwrite existing values, it is generally a better idea to pass it as a multi-property value.
Here's an example:
Set-Mailbox -Identity "[email protected]" -GrantSendOnBehalfTo @{Add="[email protected]"}
This will append the new permission instead of overwriting it. Doing this in Rewst is a little bit different because the Exchange Admin API expects certain formatting in the request when it is sent to the API and you are providing a multi-value property.
Steps to perform the same action in Rewst:
Add your
InvokeCommand
action to your workflow.For the cmdlet set the value to:
Set-Mailbox.
Add an Identity parameter with the target mailbox.
Add a
GrantSendOnBehalfTo
parameter and give it a value similar to(CTX.aad_user_id being the user that should get the perms)
:
{{ {'@odata.type':'#Exchange.GenericHashTable','add': CTX.aad_user_id } }}
Last updated
Was this helpful?