The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Hi @Amol Khairnar
Judging from the error message you provided, the place where the error is reported is:
- ... cList = Get-PnPList -Identity $libTitle -Connection $SiteConn -Includ ...
Cannot convert 'System.Object[]' to the type 'PnP.PowerShell.Commands.Base.PnPConnection' required by parameter 'Connection'. Specified method is not supported.
The cause of the error is: you are passing an array of connections instead of a single connection to the -Connection parameter of Get-PnPList.
You can check the type of the $SiteConn variable with Get-Type $SiteConn and make sure it is a PnP.PowerShell.Commands.Base.PnPConnection object, not a System.Object[] array.
You could also try using the -Web parameter instead of the -Connection parameter to specify the Web where the list is located.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.