enter image description here

In Gear Menu(Site Action Menu) i created custom Menu Using JavaScript CSOM. now i want to delete those Custom site action menus. so please let me show how i delete it.

1 Answer 1

<script  Language="JavaScript">


var siteUrl = _spPageContextInfo.webAbsoluteUrl;
var collUserCustomAction;
var clientContext;
var oWebsite;

function GetUserCustomActionSite() {
    clientContext = new SP.ClientContext(siteUrl);
    oWebsite = clientContext.get_web();
    collUserCustomAction = oWebsite.get_userCustomActions();

    clientContext.load(oWebsite, 'Title', 'UserCustomActions');

    clientContext.executeQueryAsync(DeleteCustomAction, OnQueryFailed);

function DeleteCustomAction()
    var customActionEnumerator = collUserCustomAction.getEnumerator();

    while (customActionEnumerator.moveNext()) 
        var oUserCustomAction = customActionEnumerator.get_current();

        if (oUserCustomAction.get_title() == 'ITSD Admin1') 

function OnQuerySucceeded(sender, args) {
    alert('Custom action deleted for ' + this.oWebsite.get_title());

function OnQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
  • 1
    Can you provide some context/explanation ?
    – JayHell
    Commented Jan 20, 2016 at 15:40
  • 1
    You should clear some things up about your answer, otherwise it may be deleted. What does the code do? Where to put it? Simply pasting a piece of non formatted code won't help to much. Commented Jan 20, 2016 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.