I would like to sort the results of Get-MailboxFolderPermission by the User property on Exchange Online PowerShell but it has not been working.
The PowerShell command I have tried:
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
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 }