Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property "displayName" cannot be found. #770

Open
dqncl opened this issue Oct 31, 2024 · 0 comments
Open

Property "displayName" cannot be found. #770

dqncl opened this issue Oct 31, 2024 · 0 comments

Comments

@dqncl
Copy link

dqncl commented Oct 31, 2024

Hi,

just encouraged an error while running one of your scripts. Seems like the object is not properly passed by piping it into Select-Object.

Error:

select : Property "displayName" cannot be found.
At line:1 char:112
+ ... --role Owner | ConvertFrom-Json | select -ExpandProperty displayName)
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (  :PSObject) [Select-Object], PSArgumentException
    + FullyQualifiedErrorId : ExpandPropertyNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand

Affects:
scripts/teams-list-teams-owners-and-members CLI for Microsoft 365 version

Fix:

$teamOwnerNames = (m365 teams user list --teamId $_.id --role Owner | ConvertFrom-Json | select -ExpandProperty displayName) -join ";" 
-> $teamOwnerNames = (m365 teams user list --teamId $_.id --role Owner | ConvertFrom-Json).displayName -join ";"

$teamMemberNames = (m365 teams user list --teamId $_.id --role Member | ConvertFrom-Json | select -ExpandProperty displayName) -join ";" 
-> $teamMemberNames = (m365 teams user list --teamId $_.id --role Member | ConvertFrom-Json).displayName -join ";"

$teamGuestNames = (m365 teams user list --teamId $_.id --role Guest | ConvertFrom-Json | select -ExpandProperty displayName) -join ";" 
-> $teamGuestNames = (m365 teams user list --teamId $_.id --role Guest | ConvertFrom-Json).displayName -join ";"

PS Version:

Name                           Value
----                           -----
PSVersion                      5.1.19041.5007
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.5007
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

OS Windows 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant