Feb 16 2023 08:52 AM - edited Feb 17 2023 01:13 AM
Hi Community,
Recently I needed to set a specific Default permissions to the Calendars of the members of a specific O365 Group.
As you know, O365 groups will not answer to the calls Get-DistributionGroup or Get-DistributionGroupMember in PowerShell. Instead, you need to use Get-UnifiedGroup, and there's no a Get-UnifiedGroup Member to easily pipe the action.
So, finally I wrote the necessary lines to achieve this task. It could be also useful for other kind of permissions or bulk actions over a O365 Group members. Find below what I used, ( works good ).
Write-Host "Set GL Members LimitedDetails Default Calendar Permissions" -ForegroundColor green
foreach($user in Get-UnifiedGroup -Identity "<group address>" | Get-UnifiedGroupLinks -LinkType Member | Select Alias) {
$cal = $user.alias+”:\Calendar”
Set-MailboxFolderPermission -Identity $cal -User Default -AccessRights LimitedDetails -ErrorAction silentlycontinue
}
Feel free to adapt it to your own needs or maybe suggest other codes to do it.
Feb 16 2023 07:00 PM
This is how would do this:
Yes, there is another way to set default permissions for the Outlook calendars of members of a specific Office 365 group using PowerShell.
You can use the following command to retrieve the members of the Office 365 group:
Get-UnifiedGroupLinks -Identity <groupname> -LinkType Members
This will return the members of the group. You can then loop through the members and set the default permissions for their calendars using the following command:
Add-MailboxFolderPermission -Identity <useremail>:\Calendar -User <useremail> -AccessRights Editor
You can put these commands together in a script to automate the process for all members of the group. Here's an example:
$members = Get-UnifiedGroupLinks -Identity <groupname> -LinkType Members foreach ($memberin $members) { $user = Get-Mailbox -Identity $member.PrimarySmtpAddress Add-MailboxFolderPermission -Identity $user:\Calendar -User $user.PrimarySmtpAddress -AccessRights Editor }
Feb 17 2023 01:11 AM
Hi @Mark_Albin
Thanks for taking your time to comment!
The first part is exactly what I explained in my post and, unfortunately, your script will not work, ( test it 😉 ).
If you would like to use the PrimarySmtpAdress instead of Alias, I'll suggest you to use this one, ( tested and works 😞
$members = Get-UnifiedGroupLinks -Identity <group address> -LinkType Members
foreach ($member in $members){
$user = $member.PrimarySmtpAddress+":\Calendar"
Set-MailboxFolderPermission -Identity $user -User Default -AccessRights LimitedDetails}
It's similar to my fist one but yes, you're right that this would work as well.
Hope this helps 🙂
Have a nice day.