Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda