Skip to content
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] Add-PnPListItem not working with multiple connections #4021

Open
1 of 6 tasks
fgalarraga opened this issue Jun 14, 2024 · 0 comments
Open
1 of 6 tasks

[BUG] Add-PnPListItem not working with multiple connections #4021

fgalarraga opened this issue Jun 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@fgalarraga
Copy link

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Invoke-PnPSiteTemplate or Get-PnPSiteTemplate? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/pnp/pnpframework/issues.
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue? Then please continue reporting the issue in this repo.
  3. If you think that the functionality might be related to the underlying libraries that the cmdlet is calling (We realize that might be difficult to determine), please first double check the code of the cmdlet, which can be found here: https://github.com/pnp/powershell/tree/master/src/Commands. If related to the cmdlet, continue reporting the issue here, otherwise report the issue at https://github.com/pnp/pnpframework/issues

Reporting an Issue or Missing Feature

I am attempting to batch multiple items to different list, and I have three connections open.

# Connection Setup
$currentLibCatalogConnection = Connect-PnPOnline -Url $currentLibCatalogUrl -Interactive -ReturnConnection
$publicationConnection = Connect-PnPOnline -Url $publicationSiteUrl -Interactive -ReturnConnection
$archiveConnection = Connect-PnPOnline -Url $archiveSiteUrl -Interactive -ReturnConnection

# Simple add with batch not working
$thesisBatch = New-PnPBatch  
Add-PnPListItem -List "Catalog - Theses" -Values @{"Title" = "Test"; "Date_x0020_of_x0020_Publication" = Get-Date } -Batch $thesisBatch -Connection $publicationConnection
Invoke-PnPBatch -Batch $thesisBatch -Connection $publicationConnection

I receive this error:

System.Management.Automation.PSInvalidOperationException: The specified list was not found. Notice that the title is case sensitive.
   at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPConnectedCmdlet.cs:line 101
   at System.Management.Automation.CommandProcessor.ProcessRecord()

This seems like a ghost error as if I simply remove the -Batch the command works without issue.

Expected behavior

I attempted the Add-PnPListItem with one connection and it works perfectly adding 35000 test records to a list in about 10-15 minutes. But when I use it with multiple connections it does not function.

Actual behavior

See above

Steps to reproduce behavior

See above

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

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   2.4.0                 PnP.PowerShell                      Desk      {Add-PnPAdaptiveScopeProperty, Add-PnPEntraIDGroupMember, Add-PnPEntraIDGroupOwner, Add-PnP

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

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@fgalarraga fgalarraga added the bug Something isn't working label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant