Office.useShortNamespace method (JavaScript API for Office v1.0)

JavaScript API for Office v1.0

Toggles on and off the Office alias for the full Microsoft.Office.WebExtension namespace.

Last modified: June 12, 2014

Office.useShortNamespace(useShortcut);

useShortcut

Type: boolean

true to use the shortcut alias; otherwise false to disable it. The default is true.

function startUsingShortNamespace() {
    if (typeof Office === 'undefined') {
        Microsoft.Office.WebExtension.useShortNamespace(true);
    }
    else {
        Office.useShortNamespace(true);
    }
    write('Office alias is now ' + typeof Office);
}

function stopUsingShortNamespace() {
    if (typeof Office === 'undefined') {
        Microsoft.Office.WebExtension.useShortNamespace(false);
    }
    else {
        Office.useShortNamespace(false);
    }
    write('Office alias is now ' + typeof Office);
}

// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 
}

Supported clients

Excel 2013, Excel 2013 RT, Excel Online, Word 2013, Word 2013 RT, Outlook 2013, Outlook 2013 RT, Outlook Web App, OWA for Devices, and Project 2013

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft