Forum Discussion

zapbrannigan's avatar
zapbrannigan
Copper Contributor
Nov 17, 2023

Unable to hide sharepoint list using this code

The following code worked a few months back but now refuses to connect.

 

I get this error message now:

Get-PnPList : The remote server returned an error: (403) Forbidden. At line:1 char:10 + $lists = Get-PnPList

 

 

 

$siteUrl = "https://mySite.sharepoint.com/sites/subsite/"
Connect-PnPOnline -Url $siteUrl -Interactive 

$lists = Get-PnPList

# Display the titles of all lists
foreach($list in $lists){
Write-Output $list.Title
}

 

 

 Does anyone have any ideas on this? I have full global admin privileges to the site, have logged in interactively using 2fa etc.

Thanks

No RepliesBe the first to reply

Resources