Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Property "displayName" cannot be found.

未关闭
#770 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
powershell
领域
cli

调研方向

打开 scripts/teams-list-teams-owners-and-members,检查 issue 中报告的 Owner、Member 和 Guest 名称管道。将它们与建议的替换方案进行比较,然后验证每个角色在 PowerShell 5.1 上都能生成以分号分隔的名称,且不会出现属性错误。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
PowerShell
星标
349
派生
191
平均合并
4 天 8 小时
30 天内合并 PR
13

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pnp/script-samples 的其他 Issue

查看 pnp/script-samples 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。