FieldValueSet select statement does not overcome lookup field limitation as per documentation

Matt Tebbs 0 Reputation points
2024-05-21T21:54:15.86+00:00

The documentation of FieldValueSet states "Up to 12 lookup fields may be requested in a single query. The server returns lookup values if your request includes a select statement with the fields you need".

I understand this to mean that if my list has more than 12 lookup columns, I can get the specific column(s) I need (up to 12) if I use a select statement to specify them. This works if I select for a single list item, it does not work if I select for multiple list items in a single query.

For my test setup I created a single list with 13 PeopleOrGroup columns named Person1 to Person13 and just two list items. All 13 PeopleOrGroup columns in the first item are populated.

This query works as expected, i.e. the value of item 1 column Person13LookupId is returned.

https://graph.microsoft.com/beta/sites/$siteId/lists/$listId/items/1?expand=fields(select=Title,Person13LookupId)

But this query doesn't work, Person13LookupId is not included in the returned fields

https://graph.microsoft.com/beta/sites/$siteId/lists/$listId/items?expand=fields(select=Title,Person13LookupId)

If I repeat the exercise with Person12LookupId in place of Person13LookupId the Person12 value is returned in both instances (single item query & multiple item query). If I'm reading the documentation correctly, then this API doesn't work as documented. I have a requirement to retrieve specific lookupfield values from a large list with more than 12 lookupfields in total and I am unable to do this efficiently in a single query. Rather I have to query each list item separately to get the lookup fields I need.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,921 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CharanyaB-MSFT 1,726 Reputation points Microsoft Vendor
    2024-05-23T19:29:06.5633333+00:00

    Hello @Matt Tebbs,

    Thank you for reaching Microsoft!

    As mentioned in the document, currently you can only request up to 12 lookup fields in a single query, in addition to any number of standard fields. Also, please note that APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. Any changes in these Graph APIs will be updated in changelog.

    Documentation reference: https://learn.microsoft.com/en-us/graph/api/resources/fieldvalueset?view=graph-rest-1.0#properties

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.