简体   繁体   English

在 Microsoft Graph 中获取 ListItem 的多个查找字段

[英]Get Multiple Lookup field for a ListItem in Microsoft Graph

I have a lookup column that allows multiple values per item.我有一个查找列,每个项目允许多个值。 I use the Microsoft Graph .NET SDK to retrieve all the column values for a list item:我使用 Microsoft Graph .NET SDK 检索列表项的所有列值:

ListItem item = await graphClient.Sites[siteId].Drive.Items[itemId].ListItem.Fields.Request().GetAsync();

I also tried to retrieve the lookup column specifically:我还尝试专门检索查找列:

var queryOptions = new List<QueryOption>()
{
   new QueryOption("expand", "fields(select=MultipleLookupColumn)"))
};
ListItem item = await graphClient.Sites[siteId].Drive.Items[itemId].ListItem.Request(queryOptions).GetAsync();

It correctly shows the column values, including custom columns, except for the multiple lookup column.它正确显示列值,包括自定义列,但多查找列除外。 The lookup column shows up in item.Fields.AdditionalData , but it is always an empty array, even when there are values assigned to it on Sharepoint Online.查找列显示在item.Fields.AdditionalData中,但它始终是一个空数组,即使在 Sharepoint Online 上为其分配了值。 But if I change the lookup column to disallow multiple values, it shows the value correctly.但是,如果我更改查阅列以禁止多个值,它会正确显示该值。

How can I get the values of a multiple lookup column using the Graph API?如何使用 Graph API 获取多个查找列的值? Or are multiple lookup values not supported?还是不支持多个查找值?

I found that it is a permissions issue.我发现这是一个权限问题。 I had it set up with the Files.ReadWrite.All permission, which is sufficient for reading the document library and files in Sharepoint Online, including lookup columns with single values.我设置了Files.ReadWrite.All权限,这足以读取 Sharepoint Online 中的文档库和文件,包括具有单个值的查找列。 But unfortunately not lookup columns with multiple values.但不幸的是,不查找具有多个值的列。 Once I added the Sites.Read.All permission, the multiple lookup values array was no longer empty.添加Sites.Read.All权限后,多个查找值数组不再为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft Graph .NET SDK - 检索ListItem字段 - Microsoft Graph .NET SDK - Retrieving ListItem Field 更新列表项多个查找值字段 Microsoft Graph - Update list item multiple lookup value field Microsoft Graph Microsoft Graph REST API v1.0 获取列表项(10.000.000 列表项来自 SharePoint 列表) - Microsoft Graph REST API v1.0 Get listItem(10.000.000 List Item from a SharePoint list) 如何使用 Microsoft Graph 获取 DriveItem 上的 Sharepoint ListItem - How to get Sharepoint ListItem on DriveItem with Microsoft Graph API c# SDK 如何从类Microsoft.SharePoint.Client.ListItem中获取字段类型(整数,日期时间,选择)? - how do you get the field type (integer, datetime, choice) from the class Microsoft.SharePoint.Client.ListItem? 从Microsoft Project Online中的custome字段获取Guid查找表 - Get Guid lookup table from custome Field in Microsoft Project Online 将 Microsoft Graph ListItem 输出转换为相应的 C# 类型 - Transforming Microsoft Graph ListItem Output to a corresponding C# type Microsoft Graph-获取MemberOf - Microsoft Graph - Get MemberOf 尝试使用 Microsoft 图表在多封电子邮件中获取未读邮件数 - trying to get unread message count with Microsoft graph on multiple emails SharePoint查找ListItem未加载值 - SharePoint Lookup ListItem not loading value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM