none
Not able to create dialog in Excel Add-in RRS feed

  • Question

  • I am trying to use Dialog API (Office.context.ui.displayDialogAsync), but I get "not supported" in Office 2016, 2013 and Online. I am using office javascript 1.1 and I updated my office with the latest update.

    Here's my code:

        function dialogCallback(asyncResult) {
            var dialog = asyncResult.value;
            if (asyncResult.status == "failed")
                app.showNotification('Error:', asyncResult.error.message)
            dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, messageHandler);
            dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogEventReceived, eventHandler);
        }

        function messageHandler(arg) {
            actOnMessage(arg.message);
        }

        function eventHandler(arg) {
            actOnEvent(arg.message);
        }

        function openDialog() {

            if (Office.context.requirements.isSetSupported('DialogAPI', '1.1')) {
                Office.context.ui.displayDialogAsync("https://dev.office.com/getting-started",
        { height: 80, width: 50 }, dialogCallback);
            }
            else {
                app.showNotification("Error:", "DialogAPI not supported")
            }

        }


    Thank you for any suggestions.

    Thursday, April 7, 2016 11:07 PM

Answers

  • Hi All,

    displayDialogAsync is still rolling out to all of the platforms in the 1.1 requirements release. For Mailbox apps, it will be part of the 1.4 requirements set.

    You should be able to verify the API using our /beta/ office.js Url.

    Thanks,
    -Tim

    Monday, April 18, 2016 5:50 PM
    Moderator

All replies

  • >>>I am trying to use Dialog API (Office.context.ui.displayDialogAsync), but I get "not supported" in Office 2016, 2013 and Online. I am using office javascript 1.1 and I updated my office with the latest update.

    According to your description, I have reproduced this issue, so I suggest that you could sumbit any feedback to User Voice:

    https://officespdev.uservoice.com/

    Thanks for your understanding.
    Monday, April 11, 2016 6:54 AM
  • hi there, I'm also trying to use the DialogAPI but have been unsuccessful. My code is very similar to Dmitriy's but I'm using the Dialog for Outlook Add-in. 

    I suspect that I'm not defining the Requirements Set correctly in the manifest. I'm following the documentation here:

    https://github.com/OfficeDev/office-js-docs/blob/master/reference/shared/officeui.md

    How do we set the DialogAPI requirements set along with the mailbox requirements set:

    DialogAPI:

    <Requirements> 
       <Sets DefaultMinVersion="1.1"> 
         <Set Name="DialogAPI"/> 
       </Sets> 
     </Requirements> 
     

    Mailbox:

    <Requirements> 
       <Sets DefaultMinVersion="1.1"> 
         <Set Name="MailBox" MinVersion="1.1"/> 
    </Sets> </Requirements>

    Combining the sets doesn't seem to work and adding the manifest throws an error. Please advise.Thanks!

    Tuesday, April 12, 2016 7:13 PM
  • >>>hi there, I'm also trying to use the DialogAPI but have been unsuccessful. My code is very similar to Dmitriy's but I'm using the Dialog for Outlook Add-in. 

    I have set the DialogAPI Requirements element in the manifest with Excel Add-in, but I still get "not supported".

    >>>Combining the sets doesn't seem to work and adding the manifest throws an error. 

    According to your description, you could set the Requirements element in the manifest like below:

    <Requirements>
        <Sets>
          <Set Name="MailBox" MinVersion="1.1" />
          <Set Name="DialogAPI" MinVersion="1.1"/>
        </Sets>
    </Requirements>

    For more information, click here to refer about Understanding API requirement sets 

    and here to refer about Specify Office hosts and API requirements




    Wednesday, April 13, 2016 6:07 AM
  • Hi All,

    displayDialogAsync is still rolling out to all of the platforms in the 1.1 requirements release. For Mailbox apps, it will be part of the 1.4 requirements set.

    You should be able to verify the API using our /beta/ office.js Url.

    Thanks,
    -Tim

    Monday, April 18, 2016 5:50 PM
    Moderator
  • Thanks Tim! That helps alot as I was scratching my head trying to figure out why it wasn't working with the 1.1 requirements set. Is 1.4 recommended for production use or is there a way to use the displayDialogAsync api from 1.4 along with the 1.1 requirements set?

    Thanks!

    -clfryn

    Friday, April 22, 2016 6:18 PM
  • Tim

    I too am seeing the lack of Office.context.ui object in my office.js

    These two links give me the same 

    /* Version: 16.0.6810.1000 */

    https://appsforoffice.microsoft.com/lib/beta/hosted/office.js

    and

    https://appsforoffice.microsoft.com/lib/1/hosted/office.js

    What's the beta URL?

    Cheers,

    Mark

    Monday, April 25, 2016 2:11 AM
  • So I discovered my problem - I did not have the most up to date version of Office installed

    https://github.com/OfficeDev/Office-Add-in-Commands-Samples/blob/master/Tools/LatestOfficeBuild.md

    Tuesday, April 26, 2016 12:46 PM
  • Yes, the API is brand new and rolling out to the latest releases of our apps. Some platforms have yet to be covered. That's why we have the requirements platform :)
    Saturday, April 30, 2016 5:13 AM
    Moderator
  • Is there any update on this? I'm currently having issues with the Dialog API.
    Monday, February 13, 2017 1:48 PM