Replies: 6 comments 7 replies
-
Does the If you pass |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, currently I'm not checking the presence of the value in
Do I understand it correctly that it seems like the value for the Id property of the ListItem may not be populated yet (as it is being done asynchronously under the hood) by the time it is passed into Remove-PnPListItem? If so, what's the best way to make sure that the value is ready? Shall I just try to parse it as integer when saving it into |
Beta Was this translation helpful? Give feedback.
-
Chances are that |
Beta Was this translation helpful? Give feedback.
-
Moving this to a discussion as it seems to be an issue with the custom script and not the cmdlet itself. |
Beta Was this translation helpful? Give feedback.
-
Hi @jackpoz, I've updated the script as suggested (added
It's worth to mention that according to the logs, the Any idea what's going on here? In both cases, the batch was supposed to have just a single List Item. |
Beta Was this translation helpful? Give feedback.
-
To reproduce this issue, create a batch, add a list item to the batch and then remove a list item. This will throw the same error. $batch = New-PnPBatch
Add-PnPListItem -List "Test simple list" -Batch $batch
Remove-PnPListItem -List "Test simple list" -Identity 1 -Batch $batch It doesn't matter which id is passed to @seriavio which operations do you do in the batch ? |
Beta Was this translation helpful? Give feedback.
-
Reporting an Issue or Missing Feature
I'm experiencing sporadic issues with Remove-PnPListItem cmdlet (In scope of a big custom PS Module as follows:
Remove-PnPListItem -List $script:ListName -Identity $Id -Batch $Script:UpdateBatch
) in one of my scheduled scripts, where it produces an error message sayingProperty Id was not yet loaded
.What's strange is that this script is scheduled to run daily and is written in a way that if it fails to delete something from the list today, it will try to delete it again tomorrow. And I've seen it multiple times already where it was failing to delete one or more items from the list and eventually it was succeeding with removal on the next day. Initially, I thought it could have been an issue in the older module version (1.12) so I updated it to the latest one (2.5.0) and recently got this one again (once) but it worked fine next day.
Expected behavior
The cmdlet should not throw an exception
Actual behavior
Sometimes, the cmdlet produces an exception as follows:
Steps to reproduce behavior
Remove-PnPListItem -List $script:ListName -Identity $Id -Batch $Script:UpdateBatch
, where$Id
is taken from an object that was returned byGet-PnPListItem
What is the version of the Cmdlet module you are running?
2.5.0
Which operating system/environment are you running PnP PowerShell on?
Beta Was this translation helpful? Give feedback.
All reactions