Thursday, July 18, 2019

SharePoint Online :  Access denied when uploading .aspx page to SitePages

By default, SharePoint online does not allow uploading custom .aspx pages to its site pages library.


For people with applications developed on pure react/angular and want to migrate content to SharePoint Online would be a blocked unless you want to migrate to SPFx.

Resolution:
This can be fixed by running custom scripts from admin console using  the SharePoint Online Management Shell to execute the script below.

PS Command:

$adminUPN="name@business.com"$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."

Connect-SPOService -Url https://business-admin.sharepoint.com -Credential $userCredential


After this connection establishment, run the following script to connect to your site and enable

Set-SPOSite -Identity https://business.sharepoint.com/sites/site1/ -DenyAddAndCustomizePages $false

This should enabled uploading custom files to online site pages in the SharePoint Online.
If still issues persists, try enabling the allow custom scripts and try to run the scripts and you can disable it back.



Hope this helps…

Happy Browsing!
Relax..