Forum Discussion

Chris Doran's avatar
Chris Doran
Copper Contributor
Jul 14, 2021

Add-PnPClientSideWebPart : One or more errors occurred.

Why is this happening? Does not matter what kind of web part, this one a document library, I still get the same kind of error message. Using the latest version of PnP for SharePoint Online. I can create a page with PnP, add a Text part and so on...

 

[BUG] Add-PnPClientSideWebPart : One or more errors occurred. · Issue #2913 · pnp/PnP-PowerShell (github.com)

 

Add-PnPClientSideWebPart -Page $Page -DefaultWebPartType List -Section 1 -Column 1 -WebPartProperties @{isDocumentLibrary="true";selectedListId="a4140c74-b780-417c-89c1-381e24a6e699"}
Add-PnPClientSideWebPart : One or more errors occurred.
At line:1 char:1
+ Add-PnPClientSideWebPart -Page $Page -DefaultWebPartType List -Sectio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-PnPClientSideWebPart], AggregateException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.WebParts.AddClientSideWebPart

  • Chris Doran's avatar
    Chris Doran
    Copper Contributor
    Ran my script like this to login:
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -interactive

    Delete/Remove all versions of PnpSharePoint version as
    pnp.powershell has replace those deprecated version, https://pnp.github.io/powershell/.

    Get-Module -Name *SharePointPnP* -ListAvailable | Select *
    Uninstall-Module SharePointPnPPowerShellOnline -Force –AllVersions (This did not work. So I found the path in the first output and deleted.)
    Find the path it is located. Mine was located here C:\Users\USERAccount\AppData\Local\Apps (I did leave the 2.0 folder)

Resources