I have add-in that calls a dialog box from an Outlook task pane. The Dialog is loading properly but the parent task pane is not receiving any data from the Dialog even though the dialog has the messageParent script on it. It seems that the event handler in the parent task pane is not executing at all.
I am using Outlook 2013 and also via Outlook.com. Both environments are displaying the same behaviour.
This is the code I have in the parent task pane:
var dlg;
Office.initialize = function (reason) {
$(document).ready(function () {
$("#btnTestDialog").click(function () {
Office.context.ui.displayDialogAsync("https://localhost:44300/TestDialog.aspx",
{ height: 50, width: 25, displayInIframe: true },
function (result) {
dlg = result.value;
dlg.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, processTestDialog);
});
});
});
};
function processTestDialog(result) {
var x = "";
dlg.close();
}
This is my code from my Dialog page (TestDialog.aspx)
Office.initialize = function (reason) {
$('#btnTest').click(passDataToTest);
$(document).ready(function () {
});
};
function passDataToTest() {
var response = { "status": "sucess", "message": "test" };
Office.context.ui.messageParent(JSON.stringify(response));
}
I have done a lot of research and in all my research it is saying that this code should work but I have no idea why it is not.