Expand Minimize

Hide Custom Actions

Provides information about deployed HideCustomAction artifacts.

CheckId SPT405901
TypeName HideCustomActionInventory
Severity Information
Type HideCustomAction

General Notes

You cannot hide menu items using a custom action directly using the add-in model that implements a custom action. This is because the HideCustomAction Element (MSDN API Documentation) is not available in the SharePoint CSOM object model UserCustomAction properties (MSDN API Documentation), or the SharePoint/Office 365 REST APIs. If you need to hide menu items you must use a custom action to embed JavaScript or customized CSS in SharePoint pages. The JavaScript or CSS embedded in the SharePoint pages hides the menu item then.

Readiness

Analyze your solutions and gather information of the HideCustomAction artifacts being used. Analyze which menu items or ribbon buttons are being hidden and create JavaScript and/or CSS files that hide those actions. See below for more information.

Code Examples

The code examples generate a generic custom action that adds a JavaScript block to the site. The JavaScript code will check what page the user is on and if on a certain page, it will hide a link. The code examples all refer to a HideCustomActions.js file, which is located on the JSOM tab. Modify this file to hide specific actions. You will require to identity the correct HTML element by ID and add that code to the JavaScript file.

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.