With ShortPoint SPFx version 8.3.10.0 and above, you can now apply custom styling or execute custom code across all site collections in your SharePoint tenancy using ShortPoint's Global Scripts and Styles feature. This support article provides detailed steps and information on how to use this feature.
TABLE OF CONTENTS
- Prerequisites
- What is ShortPoint’s Global Scripts and Styles Feature
- How to Apply Global Scripts and Styles
- How to Set Permissions for the ShortPoint Assets Document Library
- How to Troubleshoot Code Injection
Prerequisites
- You must have ShortPoint SPFx version 8.3.10.0 and later installed in your environment.
- You must be a ShortPoint Designer with an active license.
- You need to run a script or apply a stylesheet across all site collections where ShortPoint is installed in your SharePoint tenancy.
What is ShortPoint’s Global Scripts and Styles Feature
ShortPoint's Global Scripts and Styles feature enables you to run scripts or apply stylesheets across your entire SharePoint tenant from a single location. This streamlines the process, eliminating the need to navigate to each site collection's Theme Builder and apply codes individually through the Utilities Menu—a time-consuming method.
We acknowledge that the previous method was especially time-consuming and labor-intensive for larger organizations, particularly those with hundreds of site collections.
This new feature allows you to instantly apply a new UI or code fixes across your entire tenancy, regardless of the number of site collections and sites. It's particularly useful when our support team provides you with code to resolve an issue—you can implement it immediately throughout your SharePoint environment.
It's important to note that this feature will only apply to site collections where ShortPoint is installed.
How to Apply Global Scripts and Styles
Follow the steps below to implement ShortPoint’s Global Scripts and Styles:
Step 1: Navigate to your tenancy’s Root Site
- Go to your tenancy’s root site. It is the site that contains your main SharePoint URL. (i.e. https://[yourdomainname].sharepoint.com.
- Click the cogwheel icon to open the SharePoint Settings window.
- Open Site Contents.
Step 2: Create a document library named “ShortPoint Assets”
- Click the New button.
- Select Document Library and name it as “ShortPoint Assets”.
- [Recommended] Set appropriate permissions to ensure only administrators can edit files added to the document library. Refer to the How to Set Permissions for the ShortPoint Assets Document Library section of this article for detailed steps on this process.
Step 3: Create and upload text files
- On your device, create the following text files. You can leave them blank.
- Create a text file and name it "shortpoint-global-script.js"
- Create a text file and name it "shortpoint-global-script.css”
- Upload these text files to the ShortPoint Assets document library.
Step 4: Enable Global Scripts and Styles in the ShortPoint Dashboard
- Launch the ShortPoint Dashboard.
- Select the Advanced tile.
- Hit the Enable Global Files button. You will see the Current Status change to Enabled.
Step 5: Edit the text files and save
- You can now go back to the ShortPoint Assets and enter your desired custom codes into the text files.
- Remember to hit Save (or Ctrl+S) to ensure your changes will be implemented across site collections that have ShortPoint installed.
That’s it! You are now able to use this feature to your advantage!
How to Set Permissions for the ShortPoint Assets Document Library
To ensure the security of your SharePoint sites and prevent unauthorized changes via the Global Scripts and Styles feature, we strongly recommend configuring permissions for the ShortPoint Assets document library.
Here is how you can do it:
Step 1: Open the ShortPoint Assets document library settings
- In Site Contents, click the Show Actions ellipsis button or right-click on the ShortPoint Assets document library.
- Select Settings.
Step 2: Enter and edit Permissions for this document library
- Click the Permissions for this document library link.
- Select the entities that should not have access to the document library.
- Press Edit User Permissions.
- Apply appropriate permissions as you see fit and hit OK. In our example, we only want Read access for the selected parties.
You have now successfully modified the permissions settings for the ShortPoint Assets document library.
How to Troubleshoot Code Injection
You can disable Global Scripts and Styles for individual sites when troubleshooting issues potentially related to this feature.
To do this, simply add any of the following to the site's URL in the address bar and hit Enter:
- &sp-disable-global-files=1 (disables both script and styles)
- &sp-disable-global-script=1
- &sp-disable-global-styles=1
This allows you to view your page without any custom codes applied through ShortPoint's Global Scripts and Styles feature.
This new feature provides another set of flexible options to apply custom codes across all sites. Go ahead and try it out!