Is Office.context.ui.messageParent broken in Outlook 2016 for Mac?
Asked Answered
I

2

13

I'm working on an Outlook addin using the new Office-JS apis, and in building out the authentication flow, I've found that in the Outlook 2016 for Mac case, the dialog system seems to not work properly.

To be clear, we're using the Office Insider Fast Track build as it has much improved support for the Office-JS API.

I've been through several iterations of this particular piece (most of which worked fine both in the Windows client and the web client on Mac and Win), and have had no luck. The scenario is:

  1. List item
  2. Open up the task pane in outlook.
  3. Hit the sign in button
  4. A new window opens, pointed at our authentication portal
  5. User signs in.
  6. On auth completion, the window redirects to a page in the office add-in scope, and calls back to the parent frame with the auth token, where it can be further processed.

Steps 1 through 5 work fine on all platforms. Step 6 refuses to work on Outlook for Mac. Initially, this flow was built using the native js window.open and window.postMessage apis. As mentioned above, this worked everywhere but Outlook Mac, where, the API seemed to ignore the window options and just open the url in a new tab in whatever browser was open and never setting the child window reference (result of window.open being null).

Failing this, I followed the advice found here on SO to use the Office functionality, displayDialogAsync and messageParent. After some initial hurdles, this too was setup and working on every platform save Outlook Mac.

As there is no dev tools or JS console support in Mac Outlook, I followed the advice found here Howto: Outlook 2016 for Mac - Debugging/View Console Logs in Outlook Add-in and setup Vorlon to attempt to get some context, adding numerous logging points to try and get some context. Unfortunately, while Vorlon does pick up my auth landing page as a client, and sees the Office interfaces, none of my console outputs are presented, making it seem as though the JS isn't running at all.

At this point I'm not sure what to try next. Has anyone run into this issue, or gotten this to work on the Outlook 2016 for Mac client?

Clarifying context:

  • All auth pages are listed in the AppDomains section of the Manifest.
  • While initial versions pointed directly at our auth service (this worked on not Mac), the current version first opens up an in scope pre-auth page that redirects to the auth service.
  • The Office-JS api's block alerts, preventing their use in displaying useful information.
  • Authentication through all versions of this app have worked on both Outlook 2016 on Windows and OWA on both Win and Mac.

Thank you.

Ingeingeberg answered 4/3, 2017 at 2:32 Comment(14)
It sounds like you are doing everything right. (If you haven't already, you might want to read this: dev.office.com/docs/add-ins/develop/…). Also, we have a more recent article about using Vorlon on a Mac: dev.office.com/docs/add-ins/testing/…Inferno
Some questions: (1) Whey you say that step 6 doesn't work, does that mean you don't get the redirection to the local page or do you mean the local page opens, but messsageParent doesn't seem to work? (2) Does your handler for DialogMessageReceived do anything that would give you a visual indication that it runs, such as close the dialog? (3) If you can't find a way to see console.logs, you could try putting a div in the relevant page and "log" to the div's text property.Inferno
Sorry, I should have been more clear. Yes, the redirect works, but none of the Javascript seems to do... anything. I hadn't thought of writing out to a Div with log info, that might at least provide some kind of context. Message received never triggers at all. Thanks for the links, those are the ones I used early on to try and find what might be wrong. Tangentially, I tried to setup an event handler for when the window closes, but that doesn't seem to fire on any platform.Ingeingeberg
Seems as if the JavaScript runtime itself is not working on the local page in Outlook, but you should try to confirm that using a div as suggested. I will alert the product team to this tread.Inferno
I've updated the view to update a div in the view with console entries. I see none of them. This includes a pre-office-initialisation bit that does work outside when accessed from outside the add-in.Ingeingeberg
As I understand it, no JS runs on the local page to which you redirect in step 6. (Correct me if that's wrong.) While we're waiting for someone smarter than me to answer, the next thing that I would try is to remove from that page the <script> tag that loads office.js (and remove any Office-related JS). See if any JS will run on the page when Office.js isn't being loaded.Inferno
I did as suggested, pulling out the office JS data, and still get nothing. I also pulled out Vorlon to ensure it wasn't muddying anything, and yeah... It still doesn't seem to be doing anything at all, JS wise. I also verified that it's getting the up-to-date html/js using Charles.Ingeingeberg
Here's a suggestion from the product team: Manually clear cache. See dev.office.com/docs/add-ins/testing/… . Also, try executing something simple such as the first script reference <script>window.close()</script>.Inferno
Also be sure that the domain of page that calls messageParent is exactly the same as the domain of the host page where displayDialogAsync was called.Inferno
And some questions from the product team: Is it possible that the dialog process has crashed? Does it respond to right click inside the dialog? Could we get the Office build number from them?Inferno
Thanks for the link to the cache clearing method. That'll be useful in future. Here, however it did not help. The domain of the auth callback page is the same as the add-in's. I'll see about replacing all the script in there with the simple script above to see if it runs. As for the dialog window, right clicking in the dialog presents the back and reload options, same as the working pages. The Outlook version is 15.33 (170308)Ingeingeberg
Chiming in to say I'm also having this same issue on Outlook for MacOS, and also on Outlook for iOS. The session is being set correctly but the postMessage event is not being handled.Monophthong
I wanted to briefly pop in to say that as of at least version 15.34 (170426), the issue in outlook seems to have been resolved to the point that my sign in process works in Outlook for Mac. I've yet to dig into it at any depth, but will post more details as I have them.Ingeingeberg
Stumbled upon this SO thread and been having the same issue on Outlook for Mac (Version 15.36). The Office.EventType.DialogMessageReceived is not being handled, but Office.EventType.DialogEventReceived seems to be working fine. The same code works on Outlook on Windows.Brazen
C
3

This issue in Outlook Mac has been fixed a few months ago. If anyone still encounters this issue with a recent Outlook Mac build, please reply with the build number.

Commodity answered 19/7, 2017 at 10:17 Comment(3)
@Bᴜᴅɪ I'm not so sure that this should be deleted; "This issue in Outlook Mac has been fixed a few months ago" looks like an answer to the question.Enisle
@Enisle hmm... this is one of those border-line reviews that I feel doesn't need to be an answer, but rather should be a comment... I'll delete my comment.Audy
We are doing exactly as @Ingeingeberg doing (we are not using window.open and window.postMessage, but displayDialogAsync and messageParent) and seeing the exact problem that "the API seemed to ignore the window options and just open the url in a new tab in whatever browser was open." And messageParent is not able to post the token from the browser tab back to Outlook We are using build 16.13.1 (180523). Is this DialogAPI broken again on Mac?Phyle
C
0

The Office.context.ui is undefined in v16.17 (180909) build of Outlook for Mac 2016 using the following OfficeJS dist: https://appsforoffice.microsoft.com/lib/1/hosted/office.js

Copyist answered 4/2, 2019 at 6:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.