Simple PNP script that connects to SharePoint Online via Azure Active Directory Enterprise Application
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$clientId = "cb899782-6baa-bbbb-cccc-f7e7733cr845" $spBase = "https://client.sharepoint.com" $tenantid = "111177abb3-222d2-4333d-444-b2eb88596fe4" $pfxpath = "C:\EAppsCerts\Pipe001.pfx" $certpassword = "somepassword" $pnpConnect = Connect-PnPOnline -Url $spBase -ClientId $clientId -CertificatePath $pfxpath -CertificatePassword (ConvertTo-SecureString -AsPlainText $certpassword -Force) -Tenant $tenantid -WarningAction Ignore $context = Get-PnPContext $web = $context.Web $context.load($web) Write-host ($web) $siteLists = Get-PnPList | Where-Object {$_.Hidden -eq $false} foreach($list in $siteLists){ $tenantListTitle = $list.Title write-host ($tenantListTitle) } |