microsoft-graph-api - 使用 Graph API 如何编写 Sharepoint“个人或组”字段?
问题描述
我有一个 Sharepoint Online 列表,其中包含“个人或组”类型的列。我想使用 Microsoft Graph API(最终来自 Teams 机器人)为此类列创建一个新条目。
我的问题是这样的列包含一个查找值,我不知道如何获得这个数字。我可以从 Graph(/me 或 /users)成功获取用户对象,但返回的对象有一个完全不同的 id。如何将此链接到 Sharepoint Online 所需的内容?
示例:SG_Responsible
Graph 返回的类型为“Person or Group”的 Sharepoint 列(注意它报告为SG_ResponsibleLookupId
):
"fields": {
"@odata.etag": "\"e2977d91-fd6d-4141-8bc6-897f5bbe9840,1\"",
"Title": "Test 2",
"SG_ResponsibleLookupId": "12",
"SG_Description": "This is a Test",
...
来自的相应用户/users
:
{
"businessPhones": [],
"displayName": "John Doe",
"givenName": null,
"jobTitle": null,
"mail": null,
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "john@example.com",
"id": "76a3b5b7-768b-4dde-ba13-6d471aa2c7fd"
},
那么如何确定这个用户是 Sharepoint 的用户 #12?
解决方案
SharePoint REST API 应该能够为您提供您正在工作的网站集中的用户 ID。
用相应的值替换这些值。
SharePointWebURL/_api/web/siteusers?$filter=Email eq 'UserEmail'&$select=Id
然后,您应该能够获取可用于验证查找字段值的用户ID 。
推荐阅读
- java - Spring boot考虑定义一个类型的bean,组件扫描不起作用
- excel - 下标超出范围错误,贯穿文件夹中所有文件的宏
- ruby-on-rails - simple_form 接受集合输入的散列
- html - 材料垂直分隔线未显示
- php - HTML/PHP URL Shortener 在 URL 之后 / 在 URL 中通过 ID 重定向
- c# - 正则表达式获取所有给定单词旁边的单词
- c# - C# WCF Web 服务到 C++ DLL 调用
- javascript - 根据对象 ID 在 mongoose 中创建新表
- r - R:[Indicspecies 包] multipatt 函数:从 summary.multipatt 中提取值
- laravel - 状态消息未显示在我的视图中