How to download a page from a Document libarary using SharePoint online Powershell?

Hello SharePointers,

In this blog, I m giving you the piece of code to download  a page from a document library using Sharepoint online powershell.

$localPath = “C:\Path\Myflile name.aspx”

$password = “your password”
$pageUrl = “PageUrl”
$Username =”Your user name”
$sPassword = $password | ConvertTo-SecureString -AsPlainText -Force

$webClient = New-Object System.Net.WebClient
$webClient.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username , $password)
$webClient.Headers.Add(“X-FORMS_BASED_AUTH_ACCEPTED”, “f”)
$webClient.DownloadFile($pageUrl, $localPath)

Happy SharePointing Folks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *