msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Get-MgSiteListItem not returning all lookup columns

Open GWMatt opened this issue 1 year ago • 0 comments

Describe the bug

I am trying to retrieve selected fields for all items from a Sharepoint Online list. The list happens to have more than 12 lookup columns. I understand there is a limit of 12 on the number of lookup columns that can be returned via FieldValueSet. But I should be able to work around that using the Select qualifier on ExpandProperty.

FieldSet limitation & workaround is described at https://learn.microsoft.com/en-us/graph/api/resources/fieldvalueset?view=graph-rest-1.0#properties

If I query the list columns, Project Manager (internal name ProjectManager), a Person or Group column, is the 14th lookup column. I am using a select clause on ExpandProperty to restrict the columns returned to ProjectManagerLookupId only. If I retrieve a single item from the list ProjectManagerLookupId is included. If I retrieve all items ProjectManagerLookupId is not included for any item.

This returns ProjectManagerLookupId in the Fields.AdditionalProperties collection for the selected item if it is populated Get-MgSiteListItem -SiteId $siteId -ListId $listId -ListItemId $itemId -ExpandProperty "Fields(`$select=ProjectManagerLookupId)"

This doesn't return ProjectManagerLookupId in the Fields.AdditionalProperties collection for any of the returned items Get-MgSiteListItem -SiteId $siteId -ListId $listId -ExpandProperty "Fields(`$select=ProjectManagerLookupId)"

Expected behavior

I would expect that using the Select qualifier on ExpandProperty I could retrieve any subset of 12 or fewer lookup columns for all list items simultaneously.

How to reproduce

Create a SharePoint list with more than 12 lookup columns. Using Get-MgSiteListColumn identify the 13th lookup column. Use the code snippets above to retrieve the 13th column lookup id for a single item or all items.

SDK Version

2.1.70

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

GWMatt avatar Apr 30 '24 00:04 GWMatt