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

213
Visualizações
Cannot send information to dialog box in Outlook add-in

I cannot send information to my dialogbox in my Outlook add-in. Here is the Javascript code in the parent:

 var url2 = window.location.origin+'/dialogbox.html'
 var dialog
 Office.context.ui.displayDialogAsync(url2, {height: 50, width: 50},
           function (asyncResult) {
               dialog.messageChild('hello from the parent', {targetOrigin: "*" })     
           });

Which completes successfully to the messageChild command.

The Javascript in the child dialog box is:

Office.onReady().then(function() {
         Office.context.ui.addHandlerAsync(
             Office.EventType.DialogParentMessageReceived,
             onMessageFromParent);
         });
        
function onMessageFromParent(arg){
     console.log(arg.message)
     }

However, the message 'hello from the parent' is not printed in the console.

Instead I get the following in the console twice:

Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js. [https://localhost:3000/commands.html?_host_Info=Outlook$Win32$16.02$en-US$$$$0]

What am I doing wrong? How can I pass the message to the dialog box?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When you call the Office dialog API to open a dialog box, a Dialog object is returned. You will need to set the dialog object from the asyncResult on your local dialog variable. More information about messageChild can be found in the documentation here.

var dialog;
Office.context.ui.displayDialogAsync('https://myDomain/myDialog.html',
    function (asyncResult) {
        dialog = asyncResult.value;
        dialog.messageChild(...);
    }
);
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