Export (0) Print
Expand All

Document.getActiveViewAsync method (JavaScript API for Office v1.1)

Returns the current view of the presentation.

Last modified: June 12, 2014

Introduced in Office.js version


Available in requirement sets


Office.context.document.getActiveViewAsync([,options], callback);


Type: object

Specifies the following optional parameters.


Type: array, boolean, null, number, object, string, or undefined

A user-defined item of any type that is returned in the AsyncResult object without being altered. Optional.


Type: function

A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional.

When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter.

In the callback function passed to the getActiveViewAsync method, you can use the properties of the AsyncResult object to return the following information.


Use to...


Return the presentation's current view. The value returned can be either edit or read. "Edit" corresponds to any of the views in which you can edit slides, such as Normal or Outline View. Read corresponds to either Slide Show or Reading View.


Determine the success or failure of the operation.


Access an Error object that provides error information if the operation failed.


Access your user-defined object or value, if you passed one as the asyncContext parameter.

Can trigger an event when the view changes.

To get the view of the current presentation, you need to write a callback function that returns that value. The following example shows how to:

  • Pass an anonymous callback function that returns the view type to the callback parameter of the getActiveViewAsync method.

  • Display the value on the app's page.

function getFileView() {
    //Get whether the current view is edit or read.
    Office.context.document.getActiveViewAsync(function (asyncResult) {
        if (asyncResult.status == "failed") {
            showMessage("Action failed with error: " + asyncResult.error.message);
        else {

App types

Content apps, Task pane apps

Supported clients

PowerPoint 2013, PowerPoint 2013 SP1, PowerPoint 2013 RT, and PowerPoint Online





© 2015 Microsoft