MVPs are "independent community leaders who share their passion, technical expertise, and real-world knowledge of Microsoft products with others." - Overview,

Office 365 Advent Calendar – 23 Bulk-updating File Extensions in SharePoint Online with PowerShell


A short while ago, I had to update a fairly large number of documents in multiple libraries in a SharePoint Online site. Problem was that their file extension was .html which doesn’t display in the browser if stored in SharePoint Online, but rather these files get downloaded upon opening. The workaround – rename them to .aspx. The following scripts does this for all .html files and renames them to .aspx

Code $cred = Get-Credential Connect-PnPOnline -Url “” -Credentials $cred $ctx = Get-PnPContext $libraries = Get-PnPlist | Where{$_.BaseTemplate -eq 101} foreach($lib in $libraries) { write-host “Getting items from $($lib.Title)”