1. To Enable custom scripts.
2. Login to SharePoint Online Admin Center.
3. Click on Settings from the left navigation >> Scroll down to the “Custom Script” section.
4. Set “Allow users to run custom script on personal site” and “Allow users to run custom script on self-service created sites” options.
5. Click on OK
#Used Parameters
$AdministratonSiteURL="https://Mohan-admin.sharepoint.com"
$MySiteURL="https://Mohan.sharepoint.com"
#Get Credentials to connect
$Cred = Get-Credential
#Connect to SharePoint Online Tenant Admin and Website
Connect-SPOService -URL $AdministratonSiteURL -Credential $Cred <
#Disable DenyAddAndCustomizePages Flag
Set-SPOSite $MySiteURL -DenyAddAndCustomizePages $False
Or
$userName = "mvmohan@Microsoft.com"
$Password = "Password@1"
$AdministratonSiteURL="https://DomainName-admin.sharepoint.com/"
$MySiteURL="https://DomainName.sharepoint.com/"
#Get Credentials to connect </br>
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
#Connect to SharePoint Online Tenant Admin and Website
Connect-SPOService -URL $AdministratonSiteURL -Credential $Cred
#Disable DenyAddAndCustomizePages Flag
Set-SPOSite $MySiteURL -DenyAddAndCustomizePages $False
No comments:
Post a Comment