rest - 使用 pnp sp 时如何从 Principal Id 中找出名称?
问题描述
我需要找出我从 REST 调用返回的 principalId 编号的用户名或名称,该调用获取当前在 SharePoint 列表项上的角色分配。
我了解这可能涉及:
const r = await sp.web.lists.getByTitle('MyList').items.getById(theItem).roleAssignments()
我发现没有解释如何执行此操作的文档。
解决方案
再次回答了我自己的问题:
const assignments = await sp.web.lists.getByTitle('MyList').items.getById(theItem).roleAssignments();
const expanded = assignments[0].PrincipalId;
console.log(expanded, 'expanded');
推荐阅读
- python - 将远程 html 文件(AWS 存储桶)中的 html 内容渲染到 django-template
- r - 如何将命名的 data.frame 列表导出到名称为 purrr 的文件
- macos - MacOS Catalina launchd 无法打开输入文件错误
- java - 在 Spring 中使用异步多线程来运行并发任务
- sql - BigQuery SQL 一个从长表到宽表的热编码
- python - 获取 Pandas Dataframe 中每个特征的值不正确的行百分比的最快方法
- python - 所有访问尝试共享相同的 IP 地址 Django-Axes
- php - WordPress 主题遇到严重错误
- python - 使用 Python 快速解析 12 GB 的巨大 JSON 文件
- postgresql - PostgreSQL 多列索引未完全使用