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

JavaScript API for Office v1.1

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.

Added support for calling this method in content apps for Access.

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; 
}

App types

Content apps, Mail apps, Task pane apps

Supported clients

Access app for SharePoint, Excel 2013, Excel 2013 SP1, Excel 2013 RT, Excel Online, Outlook 2013, Outlook 2013 SP1, Outlook 2013 RT, Outlook Web App, OWA for Devices, PowerPoint 2013, PowerPoint 2013 SP1, PowerPoint 2013 RT, Project 2013, Project 2013 SP1, Word 2013, Word 2013 SP1, Word 2013 RT

Library

Office.js

Namespace

Office

Show:
© 2014 Microsoft