Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Sorting results from Get-MailboxFolderPermission

I would like to sort the results of Get-MailboxFolderPermission by the User property on Exchange Online PowerShell but it has not been working.

Results Screenshot

The PowerShell command I have tried:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Get-MailboxFolderPermission -Identity 'xyz@abc.com:\Calendar' | Sort-Object -Property User

The User property is of type Deserialized.Microsoft.Exchange.Management.StoreTasks.MailboxFolderUserId and the actual name is in the User.DisplayName property, so I tried to sort by User.DisplayName but it did not work either.

Get-MailboxFolderPermission -Identity 'xyz@abc.com:\Calendar' | Sort-Object -Property User.DisplayName

>Solution :

You need to use a scriptblock to evaluate expressions such as accessing a nested property and sorting by its value (.User.DisplayName) for each object. See Example 6 from the cmdlet’s documentation and Notes from about Calculated Properties.

Get-MailboxFolderPermission -Identity 'xyz@abc.com:\Calendar' |
    Sort-Object -Property { $_.User.DisplayName }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading