Custom actions (quick guide)
https://dev.office.com/sharepoint/docs/sp-add-ins/create-custom-actions-to-deploy-with-sharepoint-add-ins has a fantastic write up with respect to deploying Custom Actions from an Add-In. If you are in a pinch and want to deploy or remove custom actions take a look at a Powershell CmdLet. This sample will add a variety of custom actions based on a JSON definition.
Lets get to the code:
https://github.com/pinch-perfect/Infrastructure-As-Code/blob/master/InfrastructureAsCode.Powershell/Commands/Sites/SetIaCCustomAction.cs will read in a JSON file containing definitions for Site, Web, or List custom actions. The CmdLet will deserialize the JSON file and process the various Custom Actions. If the custom action is found; it will update the details. If not found; it will add the action. The following script presents the requisite pattern to connect to a site, update the custom actions, and disconnect the context.
Custom Action [Site | Web | List] samples:
- https://github.com/pinch-perfect/Infrastructure-As-Code/blob/master/HowToExtend/Samples/script-set-customaction.ps1
- Script Link [Inject Javascript files] https://github.com/pinch-perfect/Infrastructure-As-Code/blob/master/HowToExtend/SampleFiles/sample-customaction-site-scriptlink.json
- Script Block [Javascript or inject CSS] https://github.com/pinch-perfect/Infrastructure-As-Code/blob/master/HowToExtend/SampleFiles/sample-customaction-site-scriptblock.json
- List custom action https://github.com/pinch-perfect/Infrastructure-As-Code/blob/master/HowToExtend/SampleFiles/sample-customaction-list.json
Command UI [List] samples