-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Set-PnPListItem not working on lists with more than 12 lookup columns #4311
Comments
I've checked the code to clarify why PnP.PowerShell is obviouslty trying to query all list columns while I'm just trying to update e.g just one field. Found the following code in class ListItemHelper: I think it should be possible to query just the fields that are acutally rerference in the Cmdlets "value" Parameter. That way it should be easy to avoid that threshold issue. I've verified my theory using the Set-PnPTaxonomyFieldValue Cmdlet on that same list - with no issues at all. Here the code (in Microsoft.SharePointClient.TaxonomyExtensions) is just loading the field in question and everything works fine: |
By the way - this is the error message we're currently facing: I'm even getting this error, if I'm just trying to change the item's content type using Set-PnPListItem. No additional values involved. And all this just because SetFieldValues is trying to load all fields involved (for whatever reason). |
As a workaround, what happens if you load the item and updated it manually? Something like this (don't have PowerShell handy right now, but you should be able to get it to work) $li = Get-PnPListItem -Identity 1
$li["Fieldname"] = "New Value"
$li.update();
Invoke-PnPQuery |
@Tanddant Yes, indeed. That's working for me. I've already tested a fix for the code behind Set-PnPListItem. The trick is to avoid the query for all fields as mentioned in my post above: I'm avoiding to load all fields by query. The only fields the code now loads are the ones involved, if you provide any value updates. My fix so far just involved the single item update - not the batch operation. The latter one is unfortunately far more tricky. |
Expected behavior
Using Set-PnPListItem to update some values of a list item in a list having more than 12 lookup columns shouldn't run into this lookup column threshold issue as long as we are not trying to set more than 12 lookup columns in that operation.
Actual behavior
We will get the error message that the list we are operating on is exeeding the 12 lookup column threshold and thus the query couln't be processed.
Steps to reproduce behavior
What is the version of the Cmdlet module you are running?
2.12.0
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: