Govern Third-Party Service and SPFx Web Parts Availability on SharePoint Online

Overview

The modern SharePoint is becoming richer with the addition of newer web part capabilities. As a content author it gives wider options to present the content in meaningful and different ways by utilizing the available web parts. This certainly helps in building engaging content. The wide variety of web parts includes capabilities to display information within SharePoint, as well as going beyond SharePoint and fetch information from third-party services outside of Office 365 like Twitter, YouTube, Kindle, etc. However, as a SharePoint or content administrator you would like to have a control on this and govern the process.
In this article, we will explore how a SharePoint administrator can control the third-party service web parts to be made available to end-users.
 
 

What are third-party service web parts?

These web parts pull the data from services outside of Office 365. The example includes Twitter, YouTube, Amazon Kindle.
 
 

Disable third-party service web parts

These web parts can be disabled by running below PowerShell.
  1. Set-SPOTenant -DisabledWebPartIds (guid[])  
Please note, these web parts can be disabled at the tenant level. We cannot selectively disable them on a particular SharePoint site.
To disable the YouTube web part, use below command.
  1. Set-SPOTenant -DisabledWebPartIds 544dd15b-cf3c-441b-96da-004d5a8cea1d  
 
To disable multiple web parts at once, use below command.
  1. Set-SPOTenant -DisabledWebPartIds 544dd15b-cf3c-441b-96da-004d5a8cea1d, f6fdf4f8-4a24-437b-a127-32e66a5dd9b4  
Below are GUID values for out of box third-party service web parts.
  • YouTube (544dd15b-cf3c-441b-96da-004d5a8cea1d)
  • Twitter (f6fdf4f8-4a24-437b-a127-32e66a5dd9b4)
  • Amazon Kindle (46698648-fcd5-41fc-9526-c7f7b2ace919)
 

How to get the web part GUID?

In order to get the GUID of the web part, firstly place the web part on the page and open web part maintenance mode by typing “?maintenancemode=true” at the end of page URL.
 
Click “Copy data” to copy the summary of any web part. The Id parameter represents the GUID of the web part. Remove “?maintenancemode=true” from the end of page URL to leave the maintenance mode.
Use below command to re-enable all disabled web parts.
  1. Set-SPOTenant -DisabledWebPartIds @()  
 
To see list of disabled web parts, use below command.
  1. Get-SPOTenant | Select DisabledWebPartIds  
 

Hide Custom SPFx web parts

To hide custom SPFx web part from the toolbox, set hiddenFromToolbox setting to true inside web part’s manifest.json.
  1. {  
  2.   "$schema""https://dev.office.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",  
  3.   "id""34f6d7f2-262f-460a-8b65-152d784127cb",  
  4.   "alias""HelloWorldWebPart",  
  5.   "componentType""WebPart",  
  6.   
  7.   // The "*" signifies that the version should be taken from the package.json  
  8.   "version""*",  
  9.   "manifestVersion": 2,  
  10.   
  11.   // If true, the component can only be installed on sites where Custom Script is allowed.  
  12.   // Components that allow authors to embed arbitrary script code should set this to true.  
  13.   // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f  
  14.   "requiresCustomScript"false,  
  15.   "hiddenFromToolbox"true,  
  16.   
  17.   "preconfiguredEntries": [{  
  18.     "groupId""5c03119e-3074-46fd-976b-c60198311f70"// Other  
  19.     "group": { "default""Other" },  
  20.     "title": { "default""HelloWorld" },  
  21.     "description": { "default""HelloWorld description" },  
  22.     "officeFabricIconFontName""Page",  
  23.     "properties": {  
  24.       "description""HelloWorld"  
  25.     }  
  26.   }]  
  27. }  
When hiddenFromToolbox is set to true, the web part will not appear in the toolbox when you edit the page.
 
 
Points to note:
  1. Only SharePoint administrator can govern this setting.
  2. Web parts utilizing third party services (Twitter, YouTube, and Amazon Kindle) can be disabled.
  3. SPfx web parts can be disabled by setting hiddenFromToolbox to true inside manifest.json.
  4. If disabled, web parts previously added on the page will not be rendered.
 

Summary

SharePoint administrator can control the third-party service web parts to be made available to end-users using PowerShell. Web parts utilizing third party services (Twitter, YouTube, and Amazon Kindle) can be disabled using this approach. In a similar way, custom SPFx web parts can be disabled setting hiddenFromToolbox to true inside manifest.json.