You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Power Apps集合:如何从嵌套表中提取用户信息?

解决方法

可以通过嵌套ForAll遍历两层集合,直接提取value列中的用户信息并存入新集合,具体公式如下:

ClearCollect(CleanUserList, 
    ForAll(UserIDList, 
        ForAll(ThisRecord.value, 
            {
                DisplayName: DisplayName,
                MailNickname: MailNickname,
                UserPrincipalName: UserPrincipalName
                // 按需添加其他需要的用户属性字段
            }
        )
    )
)

公式说明

  • 外层ForAll(UserIDList, ...):遍历原集合中每一条SearchUserV2的返回结果
  • 内层ForAll(ThisRecord.value, ...):遍历当前结果里的value表(即匹配到的用户列表)
  • 大括号内定义新集合的字段,直接引用用户对象的对应属性即可

额外优化

如果你的MailNickname是唯一标识(每个ID仅对应一个用户),可以在SearchUserV2中添加精准筛选,减少返回结果量,提升效率:

ClearCollect(UserIDList,
    ForAll(Split(txtPastedText.Text, Char(10)),
        Office365Users.SearchUserV2({
            searchTerm: ThisRecord.Value,
            filter: "MailNickname eq '" & ThisRecord.Value & "'"
        })
    )
)

内容的提问来源于stack exchange,提问作者U53R777

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 14:47:01