Skip to content

[BUG] Add-PnPListItem & Batching doesn't work with a French created site collection & credential connectionΒ #3365

Open
@hervedorierai3

Description

@hervedorierai3

Reporting an Issue or Missing Feature

I have to import data from CSV file to a list. I use Add-PnPListItem with -Batch option to improve the import time.

I developped my script in a English site collection : no problem at all.
I tested my script in a French site collection : the Add-PnPListItem fails with error "Object reference not set to an instance of an object."
If I remove the -Batch option, the items are created in the list (but it's very, very, very long).
If I connect to the site collection with Connect-PnpOnline -Interactive, the items are created in the list (but it's a batch, so I can't connect with this option).

I'm sure that it's not a permission issue because the script delete all item in the list (Remove-PnPListItem -Batch).
I'm connected with an Azure AD Application (Register-PnPAzureADApp -ApplicationName "MyBatchApp" -Tenant xxxx.onmicrosoft.com -SharePointApplicationPermissions Sites.Manage.All -Password (ConvertTo-SecureString -String "xxxxxxx" -AsPlainText -Force) -DeviceLogin )

Expected behavior

Would expect the item is successfully added to the list 😊

Actual behavior

Add-PnPListItem fails with error "Object reference not set to an instance of an object."

image

Steps to reproduce behavior

  • Create a "Communication" site collection with "French" as language.
  • Create a simple list (only the Title column) named "BatchTest"
  • Connect to the site collection with Certificate (Connect-PnPOnline -Url $siteurl -ClientId $application_clientid -Tenant $tenant_name -Thumbprint $certificate_thumbprint)
  • Try to add an item to the list with Add-PnPListItem and -Batch option ==> Fails 😨
    $batch_add = New-PnPBatch
    Add-PnPListItem -List "BatchTest" -Value @{'Title'= 'Add with batch option'} -ContentType "Item" -Batch $batch_add
    Invoke-PnPBatch -Batch $batch_add
  • Try to add an item to the list with Add-PnPListItem but without -Batch option ==> Success 😊
    Add-PnPListItem -List "BatchTest" -Value @{'Title'= 'Add without batch option'} -ContentType "Item"

What is the version of the Cmdlet module you are running?

2.2.55 nigthly

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    batch issueIssues where the -Batch method is causing the problembugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions