Grant SendAs/SendOnBehalf to Microsoft 365 groups

  • Last update on September 26th, 2024

Custom actions are not available in the Essentials solution.

 

If you need to grant SendAs/SendOnBehalf to Microsoft 365 groups, you can use the following script:

In PowerShell:

You use the GrantSendOnBehalfTo parameter on the various mailbox and group Set-cmdlets to manage the “Send on behalf” permission for mailboxes and groups:

  • Set-Mailbox
  • Set-DistributionGroup (distribution groups and mail-enabled security groups)
  • Set-DynamicDistributionGroup
  • Set-UnifiedGroup (Microsoft 365 groups)
<Cmdlet> -Identity <MailboxOrGroupIdentity> -GrantSendOnBehalfTo <Delegates>

You use the Add-RecipientPermission and Remove-RecipientPermission cmdlets to manage the “Send as” permission for mailboxes and groups

<Add-RecipientPermission | Remove-RecipientPermission> -Identity <MailboxOrGroupIdentity> -Trustee <DelegateIdentity> -AccessRights SendAs

In a CoreView custom action:

{
 "id": "8cce8353-ddee-4d44-a824-f52f329cf70f",
 "title": "Exchange - Grant SendAs/SendOnBehalf on M365 groups",
 "lastModified": "2022-05-16T12:29:45.4590000Z",
 "target": "None",
 "tags": [],
 "vars": [
 {
 "name": "M365groupemailaddress",
 "type": "string",
 "isRequired": true
 },
 {
 "name": "Right",
 "type": "list",
 "values": "SendAs,SendOnBehalf",
 "isRequired": true
 },
 {
 "name": "User",
 "type": "string",
 "isRequired": true
 }
 ],
 "params": [],
 "columns": {},
 "version": 4,
 "statement": "param ([string]$M365groupemailaddress, [string]$Right, [string]$User)\r\n\r\nif($Right -eq \"SendAs\"){\n Add-RecipientPermission $M365groupemailaddress -AccessRights $Right -Trustee $User -Confirm:$false\n}\nelseif($Right -eq \"SendOnBehalf\"){\n Set-UnifiedGroup -Identity $M365groupemailaddress -GrantSendOnBehalfTo @{add=\"$($User)\"}\n}"
}