Everybody loves User Custom Actions in SharePoint. That’s the only recommended way of customizing SharePoint. You have heard about it. Unfortunately there is no convinient way of administering them. People have their console applications or powershell scripts to add, update and delete user custom actions. It works but it is hard to open up Visual Studio or PowerShell every time you will try out an idea on a test site.
To overcome this, I have created a tiny little tool, packaged as a bookmarklet for your browser. When you click on it, it will show your existing user custom actions and you can add new user custom actions.
It is an ongoing little project, available on github, contributions are welcome. What’s left is:
- Implement Delete operation
- Implement Update operation
- Improve the UI.
Here is how it looks today:
To use this tool, add a new bookmark in your browser and copy the content of bookmarklet.html as the url.
Resources on that topic:
Creating a bookmarklet for Exporting Web Parts
REST API for User Custom Actions (MSDN)
What it can be used for
It can be used on test sites to try out ideas. But do not use it in Production. On ther other hand, parts of this script can be used in other scenarios, like adding new functionality by site owners directly from the browser, where data is predefined.
You can use this boilerplate code to add a UserCustomAction, just put it into the textarea and click “Add new”:
Best practices for User Custom Actions
var uri = _spPageContextInfo.webAbsoluteUrl.replace(/https?:\/\//i, "\\\\").replace(/\//g, "\\");
window.prompt("Copy to clipboard: Ctrl+C, Enter", uri);
Here is an animated gif that explains how to use it: