Forum Discussion
sunnypasrija
Jun 21, 2021Copper Contributor
Connect-PnpOnline: Getting error Length can not be zero. Parameter:Length
While connecting to SharePoint Online inside azure queue function I am getting error "Length can not be zero. Parameter:Length". I am using self signed certificate, key and Client ID to connect to sharepoint online. Anyone else facing the same issue ?
- Phildo25Copper Contributor
I had the same problem and it was because I was using the older SharePointPnPPowerShellOnline Module. Where as pnp.powershell is the newer one that should be used
Then I had this error
Index was out of range. Must be non-negative and less than the size of | the collection. (Parameter 'startIndex')
But the above one was fixed by switching from the powershell 7.1 runtime to powershell 5.1
- mmr104Copper Contributor
sunnypasrija Did you figure out a solution for this? I am getting the same error when connecting to SharePoint Online with Azure Automation.
- LHoffmannUdSCopper Contributor
Is there a solution jet? I have the same problem now too. I got the base64 encoded certificate and I can connect to pnpOnline via cloud-shell but not within a automation runbook. I get the same error:
Line | 30 | Connect-PnPOnline -Url $baseSite -ClientId $appId -CertificateBase64E … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Length cannot be less than zero. (Parameter 'length')