[英]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.