Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
Cannot send information to dialog box; "Office.context.ui.addHandlerAync is not a function"

I am trying to send information to a dialog box in an Outlook web-add in.

var url = window.location.origin+'/dialog.html'
var dialog
Office.context.ui.displayDialogAsync(url2,
       function (asyncResult) {
           dialog = asyncResult.value;
           dialog.messageChild('message')     
           });

Which opens a dialog box and tries to send information to the dialog which has this Javascript:

Office.onReady().then(()=> {
        Office.context.ui.addHandlerAsync(
            Office.EventType.DialogParentMessageReceived,
            onMessageFromParent);         
    });

function onMessageFromParent(arg){
    console.log(arg.message)
    document.getElementById('ID').style.display = 'none';
}

However, that just gives me the error:

TypeError: Office.context.ui.addHandlerAsync is not a function

When I run console.log(Office.context.ui), I get:

OSF.DDA.UI.ParentUI
[[Prototype]]:Object
closeContainer:function(){ … }
displayDialogAsync:function(){ … }
openBrowserWindow:function(){ … }
__proto__:Object

As you can see, there is not a addHandlerAync function within Office.context.ui but the Microsoft documentation says to use it.

What is going wrong here? Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I look at your add-in. Its taskpane.html is not completed yet and the JavaScript is not included. However, I manually load the dialog page in the debugger and I confirm that your code in dialogbox.html is working. I can see Office.context.ui.addHandlerAsync is available in the Office.onReady handler. Would you like to fix your add-in and double check it's working?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!