Excel - displayDialogAsync not doing anything

Eric Lorite 1 Reputation point
2022-02-03T08:45:44.143+00:00

I'm using the Office Dialog API in JavaScript in an add-in that runs on Word, Excel and PowerPoint. They 3 use the same code and manifest, but in Excel the popup won't show up. Looks like it doesn't even execute the callback function, since my logs are not showing up in console.
The strange thing is that it works on Word and PowerPoint, but doesn't on Excel.
The code I'm using to open that dialog is this one:

function showLoginPopup() {
  //PÁGINA HTML CON EL SCRIPT DE MSAL PARA EL LOGIN
  var fullUrl = "https://contoso.com/fallbackauthdialog.html";

  //ABRIMOS LA VENTANA EMERGENTE PARA EL LOGIN
  Office.context.ui.displayDialogAsync(fullUrl, { height: 60, width: 30, promptBeforeOpen: false}, function (result) {
    console.log("Dialog has initialized. Wiring up events");
    console.log(result);
    loginDialog = result.value; //RESULT.VALUE REPRESENTA LA VENTANA EMERGENTE
    //CUANDO LA PÁGINA PRINCIPAL RECIBA UN MENSAJE DE LA VENTANA EMERGENTE, SE LLAMARÁ A LA FUNCIÓN PARA
    //PROCESAR ESE MENSAJE
    loginDialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
    loginDialog.addEventHandler(Office.EventType.DialogEventReceived, () => {
      libreriaLoading.showToast({
        text: 'No se ha podido iniciar sesión',
        type: 'warning',
      });
      tokenAuth = null;
      localStorage.clear();
      document.getElementById("botonlogin").disabled = false;
      libreriaLoading.hideLoading();
    });
  });
}
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
854 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,399 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ruizhi Sun 6 Reputation points Microsoft Employee
    2022-02-24T02:45:02.35+00:00

    Hello @Eric Lorite
    Sorry for reply so late because we team mainly focus on GitHub and Stack Overflow.
    We colleagues tried but failed to repro this issue on both win32 and online. So I want to know if this issue still exists.
    If yes, please show some other details including but not limited to platform and detailed steps to repro.

    Btw, we strongly suggest you to submit issue on GitHub (https://github.com/OfficeDev/office-js/issues) so that we can trace your issue accurately and rapidly.
    Thanks.

    0 comments No comments