Would appreciate some help here.
Using the following powershell code I can access all Sharepoint online web pages but for any page containing _layouts
I get:
Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (401) Unauthorized."
I am using an admin account.
What setting do I need to change to access these pages via this method?
$webClient = New-Object System.Net.WebClient
$webClient.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
$webClient.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
$HTML = $webClient.DownloadString($cloudUrl)