Monday, January 22, 2018

Custom Scripts setting in SP Online and Findings

Custom Scripts in SP Online:

 By default, script is allowed on sites that admins create. It is not allowed on OneDrive, on sites users create themselves (Communication sites and Modern Team sites), and on the root site for your organization.

Findings:
1. Assuming you already added scripts on admin created sites and then blocked scripting. In this case existing scripts keeps working as expected but editing is not allowed.
2. On blocking certain webparts and features are deleted and on unblocking all those features are added back. ContentEditor webpart will be removed on blocking.
3. Any site that is created with mailbox behind like Microsoft Teams site, groups site, planner site, communication site, modern team site are by default blocks custom scripting.
4. On blocking script SP Online doesn't stop from uploading script files like .js, .master, .ascx files. According to below MS article it should block but it's not the case.

To find current setting use bellow commands:
Connect-SPOService -url https://imfo365-admin.sharepoint.com -Credential $credential
$site=Get-SPOsite https://imfo365.sharepoint.com/sites/Dev
$site.DenyAddAndCustomizePages

To change setting:
Connect-SPOService -url https://imfo365-admin.sharepoint.com -Credential $credential

Set-SPOsite https://imfo365.sharepoint.com/sites/Dev -DenyAddAndCustomizePages 1 - No more custom scripts (Enabled)

Set-SPOsite https://imfo365.sharepoint.com/sites/Dev -DenyAddAndCustomizePages 0 - Custom scripts are allowed(Disabled)

For more details use below link.
http://go.microsoft.com/fwlink/?LinkId=397546




No comments: