1

I am using Powershell to assign some Mailbox Folder Permissions for every user in our organization, I am 100% sure that I use the correct name of the folder, but PowerShell cannot find the folder. However, when I execute MailboxFolderStatistics, I can see the folder.

First, I tried to assign the permissions:

Add-MailboxFolderPermission -Identity [email protected]:\Calender -User "Default" -AccessRights LimitedDetails

That resulted in the following error: The operation couldn't be performed because '[email protected]:\Calender' couldn't be found.

Because of the error I wanted to list all folders for that mailbox with the command

Get-MailboxFolderStatistics -Identity [email protected]:\Calender | select-object Identity, ItemsInFolder, FolderSize

The result:

Identity                                                                 ItemsInFolder FolderSize             
--------                                                                 ------------- ----------             
...       
[email protected]\Calender                                                    3 17.02 KB (17,432 bytes)       
...

This confirms for me that the folder does exist, but I still can't assign permissions to it.

Can somebody help me with this?

Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
Koen Hollander
  • 167
  • 2
  • 11

1 Answers1

0

If you are setting mailbox folder/calender permissions to an account that is already associated with a mailbox with some level of permissions, you will use Set-MailboxFolderPermission.

Since you are setting the "Default" permission and not another explicit account to access it, this is why you are getting that error using Add-MailboxFolderPermission.

Use the Set-MailboxFolderPermission cmdlet to modify folder-level permissions for users in mailboxes. This cmdlet differs from the Add-MailboxFolderPermission cmdlet in that it modifies existing permission entries.

Source

Powershell

## 1. -- Connect to Exchange Online
$emailAddr = "[email protected]";
Import-Module ExchangeOnlineManagement;
Try { Disconnect-ExchangeOnline; } Catch { $false };
$ExoStatus = Try { Get-MailboxLocation $emailAddr; } Catch { $false; };
If (!$ExoStatus){ Connect-ExchangeOnline -UserPrincipalName $emailAddr; };

Set-MailboxFolderPermission -Identity room:\Calender -User "Default" -AccessRights LimitedDetails
Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
  • When I use Set-.... it gives me the same error, unfortunately. – Koen Hollander Oct 11 '22 at 13:37
  • @KoenHollander I just edited the answer, rather than using email address or UPN, use `SamAccountName` as in the edited example I just made. Try the same with `Add-MailboxFolderPermission`. Now that I look over some of my scripts for M365 Exchange Online mailbox commands, that's how I define the logic. – Vomit IT - Chunky Mess Style Oct 11 '22 at 14:59
  • So use `room:\Calender` rather than `[email protected]:\Calender`... I'll update the answer to state this explicitly if I confirm it worked for you. Sometimes your domain and UPN may be different than perhaps some explicit default, but I think I recall this vaguely in my use case as well and that's why I use `SamAccountName` for the `-Identity` parameter value rather than mail address or UPN value. – Vomit IT - Chunky Mess Style Oct 11 '22 at 15:05
  • I tried your edit, however I still have the same error. Strange. – Koen Hollander Oct 14 '22 at 14:07
  • @KoenHollander I just made one other edit adding the logic to ensure connection to Exchange Online before the other commands run. You'd just drop your email address into the value of the `$emailAddr` and then run it all together and see if that helps. Let me know if this does it for you. Also, can you tell me if you have an M365 subscription like E3, A3, etc. if you know the plan you have for your Outlook online? – Vomit IT - Chunky Mess Style Oct 14 '22 at 15:20