Skip to main content
A newer version of this page is available. .

CustomCommandExecutedEventArgs Class

Provides data for an event that occurs after a custom command has been executed on the client side.

Declaration

export class CustomCommandExecutedEventArgs extends EventArgs

Remarks

Use the OnCustomCommandExecuted(String) property to assign a handler to the event.

function onCustomCommandExecuted(s, e) {
    switch (e.commandName) {
        case 'insertEmailSignature':
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, '_________');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'Best regards,');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'John Smith');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'john@example.com');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, '+1 (818) 844-0000');
            break;
        case 'sendEmail':
            var text = s.document.getText();
            var mailto_link = 'mailto:bob@example.com?subject=Test&body=' + encodeURIComponent(text);
            window = window.open(mailto_link, 'emailWindow');
            if(window && window.open && !window.closed)
                window.close();
            break;
    }
}

For a full example, see Ribbon Customization demo.

Inheritance

EventArgs
CustomCommandExecutedEventArgs

Properties

commandName Property

Gets the name of the processed command.

Declaration

commandName: string

Property Value

Type Description
string

The processed command’s name.

parameter Property

Gets an optional parameter that complements the processed command.

Declaration

parameter: any

Property Value

Type Description
any

A value that contains additional information about the processed command.