powershell icon indicating copy to clipboard operation
powershell copied to clipboard

Invoke-PnPBatch: Issue submitting sequential batches

Open soaway opened this issue 2 years ago • 2 comments

We need to update large libraries with up to 1m documents per library.

Using Set-PnPListItem in a loop with batching, trying to submit 1000 document per batch:

foreach ($item in $Items){ Set-PnPListItem ... -Batch $batch if( $Count % 1000 -eq 0) Invoke-PnPBatch -Batch $batch } }

On submitting a second batch we are getting 20 lines the same error (batch size here is 10):

The 'Type' attribute is invalid - The value 'Object[]' is invalid according to its datatype 'http://schemas.microsoft.com/sharepoint/clientquery/2009:MethodParameterTypeType' - The Enumeration constraint failed. 200 https://...

Tried to use -Force, the same

Is it a bug? is there a workaround?

soaway avatar Jan 10 '22 21:01 soaway

just to be sure, do you call $batch = New-PnPBatch after every invokation of Invoke-PnPBatch -Batch $batch ? as I think you need a brand new batch object after you have submitted it with Invoke-PnPBatch

jackpoz avatar Jan 13 '22 19:01 jackpoz

Yes, I've tried. It says in doc, you cannot submit twice (not sure what that means) Also tried adding $batch = $null before re-declaring, all with no difference. The feature can really save us lot's time as we are migrating 2m records, any other ideas? Thanks!

soaway avatar Jan 14 '22 00:01 soaway

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Dec 24 '22 02:12 github-actions[bot]

@soaway - Sorry for the delay. We've closed a couple of issues related to batch, if the problem continues, please open a new issue with all the details. Thank you.

veronicageek avatar Feb 16 '23 18:02 veronicageek

Thanks for following up, Veronica.

soaway avatar Feb 17 '23 02:02 soaway