none
Office.context undefined RRS feed

  • Question

  • Hi,

    I'm running into some strange behaviour when running my app through "Excel Web App" (the app functions without any issue in Excel 2013).

    It seems that when I try to run the app in Excel Web App that the Office.context property is not getting activated as it should. Stepping through the javascript I see the error in Office.js: "Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is -5".

    I was initially wondering if the office.js file has not fully loaded when I'm trying to access the Office.context object - but I don't believe this is the case.

    Our solution is fairly complex - so it'll be difficult for me to post code. Basically we have 2 aspx pages which both reference the same javascript file. Both pages load the Office.js file and the Office.initialize() function is implemented in our javascript file.

    Here is the Office.Initiatilize function we use:

    Office.initialize = function (reason) {
        // Access the Office application object
        _app = Office.context.application;
        //Access settings and document objects for document Agaves (ContentExtension and TaskpaneExtension)
        _settings = Office.context.settings;
        _document = Office.context.document;
        //Access documentContainer object for documentContainer Agaves (TaskPaneExtension)
        _documentContainer = Office.context.documentContainer;
       //do some workbook checks...
    }

    When this function is called when the second page loads - then the code breaks on the first line - stating "Office.context is undefined"

    Any help will be greatly appreciated.

    Thanks,

    Matt

    Wednesday, January 29, 2014 9:25 AM

Answers

  • Hi Matt,

    If I understand correctly, you are navigating the page in apps? Do I understand correctly?

    As far as I know, navigating the main page of Web App are not allowed. You can get more detail from article below:
    Understanding the runtime- Web apps

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 30, 2014 9:09 AM
    Moderator

All replies

  • Hi Matt,

    If I understand correctly, you are navigating the page in apps? Do I understand correctly?

    As far as I know, navigating the main page of Web App are not allowed. You can get more detail from article below:
    Understanding the runtime- Web apps

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 30, 2014 9:09 AM
    Moderator
  • Hi Fei,

    Thanks for this, I'll look at refactoring our app.

    Cheers,

    Matt

    Monday, February 10, 2014 3:44 PM