Office-js: [Mac] Unable to access Office.context.ui object in dialog window

Created on 8 Feb 2019  路  19Comments  路  Source: OfficeDev/office-js

We are initiating an SAML SSO flow in a dialog window that is opened via an Outlook plugin. The login
flow completes but we are not able to call the messageParent method on the Mac Outlook 2016 client.The
Office.context.ui object is not available when debugging the issue.

This behaviour is only present on the Mac Outlook 2016 Desktop Client, I have tested the following scenarios:

  • Outlook Live on Firefox,Chrome and Safari (Both on Mac and Windows)
  • Windows Outlook 2016 Desktop client
  • Mac Outlook 2016 Desktop Client (16.21) (190117) - Fails

Expected Behavior

The Office.context.ui object should be available to the execution context in the dialog window.

Current Behavior

The Office.context.ui is undefined when accessed from the dialog window

Steps to Reproduce, or Live Example

  • Open a dialog window using Office.context.ui.displayDialogAsync
  • Attempt to post a message to the host using Office.context.ui.messageParent

Additional details:

  • The dialog window performs a redirect to our API (different domain) which generates the script which calls the dialog API
  • The API domain is added to the list of app domains in the manifest

Context

We are trying to authenticate the user via a SAML SSO flow in a dialog window.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office Online]: Mac Outlook 2016 Desktop Client (16.21) (190117)
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: Mac Outlook 2016 Desktop Client (16.21) (190117)
  • Operating System: Mac
  • Browser (if using Office Online): N/A

Useful logs

N/A

author feedback

All 19 comments

Hi.
Are you calling messageParent from inside Office.initialize = function (reason) {...} ?

I am using the Office.onReady method to register a callback within which I am calling Office.context.ui.messageParent.

Hi @markb-trustifi , I have exactly the same bug on OSX 10.13 Mac PowerPoint 16.22 (190211)

On the Dialog, after the auth is complete, I'm inside a initialize, Office.context.isDialog is false, object Office.context.ui is present, but messageParent is undefined

No error with web office.

You can try to solve this issue the way that I did:
https://github.com/OfficeDev/office-js/issues/382#issuecomment-463261231

I could give it a try thanks. I though you re a member of the OfficeDev team, sorry to ping you like that.

@markb-trustifi using native postMessage is indeed simpler and have the advantage to work at least

@dmahugh why closing this issue? I do not see any new release, fix commit, or explanation... This bug is real and still present.

My mistake, @JSteunou - I saw your last comment and thought it was working, but I've read both threads and understand now. I'll re-open the issue.

@exextoc or @danielgwilson, can you comment on this dialog API issue?

Please check if you have this code in outlook manifest:

<AppDomains>
   <AppDomain>https://login.windows.net</AppDomain>
   <AppDomain>https://login.microsoftonline.com</AppDomain>
</AppDomains>

Please check if you have this code in outlook manifest:

<AppDomains>
   <AppDomain>https://login.windows.net</AppDomain>
   <AppDomain>https://login.microsoftonline.com</AppDomain>
</AppDomains>

Why do we need to allow the MS login domains?

@dmahugh I think we should we mark this as an open bug.

Why do we need to allow the MS login domains?

I'm using outlook dialogs to login to Microsoft Exchange server. If you intend to login to different target (SAML SSO) you have to add to manifest other urls.

@markb-trustifi Got it

However, this does not answer the original question/issue.

I'm seeing this issue too with Outlook for Mac Version 16.16.12 (190715). This is a big problem.

This is the value of Office.context in the dialog window:

{
  "contentLanguage": "en-US",
  "displayLanguage": "en-US",
  "touchEnabled": false,
  "commerceAllowed": true,
  "host": "Outlook",
  "platform": "Mac",
  "isDialog": true,
  "diagnostics": {
    "host": "Outlook",
    "version": "16.16.715.12",
    "platform": "Mac"
  },
  "license": { "value": "" },
  "ui": {},
  "auth": {},
  "requirements": { "_setMap": { "_sets": { "dialogapi": 1.1 } } },
  "roamingSettings": { "_rawData$p$0": {} }
}

I am experiencing same issue, do you have some updates on this?

We are not able to reproduce the issue (Office.context.ui undefined). Could you paste a code snippet that reproduces the issue?

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.

I had a similar problem, and found the problem in my case:

In Outlook Desktop 2016 Windows, I used the displayDialogAsync and then in my open dialog box the Office.context.ui.messageParent was undefined:
Object doesn't support property or method 'messageParent'

I debugged and found out that similar to what @JSteunou described, my Office.context.isDialog is false.

While debugging deeper into office.js, I found out that it detects whether to be a dialog or not by parsing the window.location.search where the displayDialogAsync added a _host_Info parameter automatically.

Now my problem was that I used angular to create the office add in, let the angular router create the url for the displayDialogAsync. The router included all query parameters of the task pane as well, therefore the url of my dialog box contained two _host_Info parameters, where only one claimed to be a Dialog, which confused the office.js naturally.

So be sure to have no _host_Info query parameter in your url to displayDialogAsync!

It works in Outlook Web because there, the original task pane iframe does not contain a _host_Info.

Hope this helps somebody 馃槄

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Alturos picture Alturos  路  4Comments

jacobx1 picture jacobx1  路  4Comments

cawise picture cawise  路  4Comments

Jarch09 picture Jarch09  路  3Comments

KantilalJadav picture KantilalJadav  路  4Comments