Force Outlook Add-in popup to open with embedded browser - outlook-web-addins

I'm seeing an issue with my Outlook Add-in (running in Outlook 2016) where when I open a popup window using window.open, it sometimes opens in the user's default browser (e.g. Chrome) instead of the browser running the add-in (e.g. the IE11 web view embedded in Outlook 2016). This is a problem because it prevents the popup window from communicating with the add-in, which is necessary for clickjacking protection.
Is there a way to force the popup window to be opened in the same browser that is running the add-in, without using the Dialog API? I would like to support requirement set 1.3.

You should check to see if the displayDialogAsync API exists. It was added in requirement set 1.4.
If it exists, we recommend using it. Please note that the dialog can only call the Office.context.ui.messageParent API. This API allows the dialog to communicate one-way with the add-in. The add-in can use those messages to leverage the Office.js APIs.
If the displayDialogAsync API doesn’t exist you can leverage window.open. However, in this case the default browser will not be launched.

As 2022 docs were updated.
The API documentation was moved from dev.office.com (these links don't work anymore) to learn.microsoft.com. And here you will find an example on how to use this api.

Related

Close open Desktop Taskpane using office.js or Add-in manifest function

We have created add-in manifest xml file for our application and also embed office.js file.
We have use custom ribbon feature by assigning url to icon. When we click on icon, it open task pane on desktop. We want to open third party url in new window of browser using Add-in manifest and taskpane should be close.
We have gone through AppDomains and uses Office.addin.hide function. But both solutions are not working.
Please provide us solution if exist.
Office.js doesn't provide anything for opening a new tab in a web browser. Instead, you can display a popup message. In Excel, you can use the following code to hide the task pane:
Office.addin.hide();
For example:
function onCurrentQuarterDeactivated() {
Office.addin.hide();
}
See Show or hide an Office Add-in in a shared runtime for more information.
You may try to use UI less function, in UI less function, you could execute a javascript code to open a page in the default browser.
You could refer to this answer.
Open directly a web page from a button in Ribbon in a browser outside Excel?

Default browser in excel addin

I am working on Excel add-in but I am new in office.js.
I would like to know if there is a way to set a browser different from IE 11 as default browser to open the add-in.
I saw the same question on URL below, but I didn´t find if the API mentioned on the answer was developed.
How to set the default browser in word addin
I'm afraid that there is currently no API to determine which browser is used when the add-in is running in desktop Office on Windows. (If it is running in Office Online, then of course it opens in whatever browser you are using.)

Outlook Addin window.open

I´m new to the addins, just want to perform a simple task as creating a button with a link in the taskbar that opens a browser and that´s it.
So far created the project based on ms tutorial and everything is working great (with fixed certificate problems).
To my understand this should be as easy as to create a button with an ExecuteFuncion actions mapping to a javascript function with a window.open
e.g.
function windowOpen(event)
{
window.open("https://www.microsoft.com");
event.completed();
}
Thanks for the help,
Regards,
André
For security reasons, Outlook does not support window.open directly inside of Add-ins. To open a window in an Outlook Add-in you can use the displayDialogAsync API (documentation here.) We recommend this guide to understand end-to-end usage of displaying a dialog in an Add-in.

window.opener does not work in Excel for Windows

I have built an Excel add-in, it opens a popup by window.open, then the add-in communicates with the popup site. I just realised that it does NOT work in Excel for Windows, the reason is that the popup can NOT get the host by $window.opener.
To illustrate this and avoid cross-domain, I have made a xml, which refers to the add-in and the test page. It works well in Excel Online in Chrome and in IE. However, while running it in Excel for Windows, $window.opener returns undefined.
Could anyone tell me what happened, and what's the workaround?
(for people who recommend Dialog API, please see this thread. So now neither Dialog nor window.open works in Excel for Windows).
UI.messageParent also won't work? It's from the official docs.
Example:
Office.context.ui.messageParent("Message from Dialog box")
Docs:
Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent.
(I assume this isn't the Dialog API which you referring)

SharePoint and Forms Based Authentication Issue - Office Apps no longer work

We have several sites that use Forms Based authentication (FBA) within SharePoint. Many of them have been running for months without issues. Within the last week or two we have noticed the following behavior for users trying to access a Read Only Microsoft office document (currently only verified with the 2007 versions of Excel and Word).
The behavior we are seeing exhibited:
The Document starts to open
Within the Office application an IE Window opens with the FBA login screen. There is also a Hyperlink in the top left saying Skip to main content
Clicking cancel several times will open the document
If you identify the site as an IE Trusted site the login screen with the Office app, everything works as before (not an option for the majority of our sites)
Non offices files, like PDFs, do not exhibit this behavior
Non IE Browsers that we have tested (FireFox, Chrome) do not exhibit this behavior.
Is anyone else seeing this issue? I assume it was an update sent from Microsoft that has resulted in this issue, since we are seeing it on multiple sites where the code has not been updated.
Thanks
The issue we ran into is there was a policy file applied on our network that caused the UAC prompt to be disabled for Vista/Win 7. When this happens, protected mode gets turned off for the IE browsers, which caused the issues we were seeing.
If you want Office integration to work under forms authentication you should do the following:
Turn on client integration in Central Administration for the forms-auth-enabled application
Use persistent cookies for authentication in the forms-auth-enabled application
On the client computer, add the site to trusted sites in IE
If you still see a login screen embedded in Office documents that you open, try the following on the client computer (if Windows 7):
Go to Control Panel, User Accounts
Click Manage User Account Control Settings
Change slider to Never Notify
Click OK and reboot the computer

Resources