Snippet of code to remove specific user actions on SharePoint online / Office 365. Handy if you decide later you don't want a script anymore. Make sure you scope it to web / site / list, in my example I was deploying the actions at site collection level and needed to remove it as it was slowing down the page load too much.
private static void RemoveCustomActions(ClientContext context) { Site site = context.Site; context.Load(site, x => x.UserCustomActions); context.ExecuteQuery(); for (int i = 0; i < site.UserCustomActions.Count; i++) { if (site.UserCustomActions[i].ScriptSrc != null && site.UserCustomActions[i].ScriptSrc.Contains("bundle.js")) { site.UserCustomActions[i].DeleteObject(); break; } } context.ExecuteQuery(); }
Some of the example taken from: http://sharepoint.stackexchange.com/questions/164745/unable-to-unregister-usercustomactions-added-at-location-scriptlink-using-csom, this post also has a JScript example.