We have an O365 add-in that works on Calendar. It puts HTML to the body of the invite. All works well except the Image we put. How to make the image appear in the Invitation email view?
var logo = "<div style=\"line-height:60px\"><img src=\"https://static-a.test.com/a2/custom-assets/enterprise/4714/isg_logo/d05aa76d58614c0e88b864eec963cec0.png\" height=\"30\" alt=\"Test Meet\" style=\"user-select: none;\" tabindex=\"0\"></div>";
var formattedBody = agenda
+ _.repeat(newLine, 1)
+ logo
+ testInvitation;
return Q.oinvoke(Office.context.mailbox.item.body, "setAsync", formattedUserBody, { coercionType: coercionType })
.then(function() {
logger.info("Add meeting completed successfully");
});
Is there another way to fix it or is it a known limitation of Outlook?
Logo renders properly in Calendar view, not on Email view
Some VSTO add-in can render the logo, but not Office 365 addin
Logo is seen in OWA and Mobile apps, but not in Outlook 2016 Mac and windows
We fixed the issue by following this link in Outlook 2013.
----- 01/09/19 - Update on Issues following the Solution provided ----------
The primary issue reported got fixed by the solution. Now, we can see Logo in email invitation, but it is broken in Calendar view.
The changed code:
var formattedBody = agenda
+ _.repeat(newLine, 1)
+ "<img src='cid:testMeet.png'/>"
+ testInvitation;
Office.context.mailbox.item.addFileAttachmentAsync(
"https://static-a.test.com/a2/custom-assets/enterprise/4714/isg_logo/d05aa76d58614c0e88b864eec963cec0.png",
"testMeet.png",
{asyncContext: null, isInline: true},
function (asyncResult) {
Office.context.mailbox.item.body.setAsync(
formattedBody,
{ coercionType: Office.CoercionType.Html, asyncContext:null });
});
This fix also breaks the logo rendering in Outlook Mobile App. Please advise as we need to have the logo between Agenda (if any) and our Text.
---- Screenshot 01/16/2019 -----
------ Outlook Matrix 01/26/2019 -------
Adding an image to the body this way is incorrect, and as you have seen, sometime buggy. Instead you should use addFileAttachmentAsync, more specifically the isInline property, which will allow you to use a cid: reference to add your image.
An example of this would be:
Office.context.mailbox.item.addFileAttachmentAsync(
"https://static-a.test.com/a2/custom-assets/enterprise/4714/isg_logo/d05aa76d58614c0e88b864eec963cec0.png",
"testMeet.png",
{asyncContext: null, isInline: true},
function (asyncResult) {
Office.context.mailbox.item.body.setAsync(
"<img src='cid:testMeet.png'/>",
{ coercionType: Office.CoercionType.Html, asyncContext: null });
});
Related
I am developing an add-in for PowerPoint which receives data from a server with WebSockets. When data is received, I update the slide.
But, I want to know if it's possible to update slide content (Text, XmlSvg...) after the presentation is started? And how?
Currently, I update content like this but when I try during presentation, I got an internal error:
Office.context.document.setSelectedDataAsync(
myText,
{
coercionType: Office.CoercionType.Text
},
result => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error(result.error.message);
}
}
);
Thanks for your help.
I'm troubleshooting an issue where a pop-up created by an Outlook add-in isn't communicating to its parent when using Office.context.ui.messageParent() in the Outlook desktop client for Windows.
The issue started occurring after a Windows 10 update (1903). The Outlook desktop client version I'm using is: 16.0.12026.20344. I'm loading the Office JS Api through the CDN provided in their Github repo.
Initially, I thought it was a lack of registering the correct events on the pop-up window but the event raised (dialogEventReceived) when the pop-up window is closed is registered and handled correctly.
There are no logged errors after calling Office.context.ui.messageParent().
I've made sure that the pop-up window (handling authentication in this case) is correctly loading the Office JS api and is initializing.
All applicable app domains have been correctly listed in the add-in's manifest file.
Office.context.ui.displayDialogAsync(fullUrl,
{
height: 60,
width: 20,
displayInIframe: false
}, function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
//showNotification(asyncResult.error.code = ": " + asyncResult.error.message);
} else {
dialog = asyncResult.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
dialog.addEventHandler(Office.EventType.DialogEventReceived, processDialogEvent);
}
});
Office.initialize = function() {
console.log('oauth2 redirect');
debugger;
Office.context.ui.messageParent(window.location.href);
};
The expected behavior is that the pop-up raises the dialogMessageReceived event.
I'm trying to develop a Firefox add on using WebExtensions. What I'm trying to do is open a new Firefox tab or window when the user clicks the notification. But it doesn't work.
When I click the notification, nothing happens.
I'm creating notifications like:
var q = chrome.notifications.create({
"type": "basic",
"iconUrl": chrome.extension.getURL("128-128q.png"),
"title": 'title',
"message": 'content'
});
chrome.notifications.onClicked.addListener(function(notificationId) {
window.open('http://www.google.com');
});
browser.notifications.onClicked.addListener(function(notificationId) {
window.open('http://www.google.com');
});
q.onClicked.addListener(function(notificationId) {
window.open('http://www.google.com');
});
var audio = new Audio('message.mp3');
audio.play();
How can I make this work?
It appears that the problem is that you are attempting to open a new URL in a way that does not work.
The following should work, using chrome.tabs.create():
var q = chrome.notifications.create("MyExtensionNotificationId", {
"type": "basic",
"iconUrl": chrome.extension.getURL("128-128q.png"),
"title": 'title',
"message": 'content'
});
chrome.notifications.onClicked.addListener(function(notificationId) {
chrome.tabs.create({url:"http://www.google.com"});
});
However, you need to be testing this in Firefox 47.0+ as support for chrome.notifications.onClicked() was only added recently. My statement of Firefox 47.0+ is based on the compatibility table. However, the compatibility table has at least one definite error. Thus, a higher version of Firefox may be required. The code I tested worked in Firefox Nightly, version 50.0a1, but did not work properly in Firefox Developer Edition, version 48.0a2. In general, given that the WebExtensions API is in active development, you should be testing against Firefox Nightly if you have questions/issues which are not functioning as you expect. You can also check the source code for the API to see what really is implemented and when it was added.
Note: this works with either chrome.notifications.onClicked or browser.notifications.onClicked. However, don't use both to add two separate anonymous functions which do the same thing as doing so will result in whatever you are doing happening twice.
I did not actually test it with your code, but I did test it with a modified version of the notify-link-clicks-i18n WebExtensions example. I modified the background-script.js file from that example to be:
/*
Log that we received the message.
Then display a notification. The notification contains the URL,
which we read from the message.
*/
function notify(message) {
console.log("notify-link-clicks-i18n: background script received message");
var title = chrome.i18n.getMessage("notificationTitle");
var content = chrome.i18n.getMessage("notificationContent", message.url);
let id = "notify-link-clicks-i18n::" + title + "::" + message.url;
chrome.notifications.create(id,{
"type": "basic",
"iconUrl": chrome.extension.getURL("icons/link-48.png"),
"title": title,
"message": content
});
}
/*
Assign `notify()` as a listener to messages from the content script.
*/
chrome.runtime.onMessage.addListener(notify);
//Add the listener for clicks on a notification:
chrome.notifications.onClicked.addListener(function(notificationId) {
console.log("Caught notification onClicked with ID:" + notificationId);
//Open a new tab with the desired URL:
browser.tabs.create({url:"http://www.google.com"});
});
My preference for something like this where a unique ID is possible is to provide a unique ID, that both identifies that the notification was displayed by my add-on and what the notification was. This allows the listener function to choose to only act on notifications which were displayed by my add-on and/or only a subset of those I display, or have different actions based on why I displayed the notification.
The reason you had trouble here in figuring out what was not working is probably because you did not reduce the issue to the minimum necessary to demonstrate the issue. In other words, it would have been a good idea to just try opening a new URL separately from the notifications onClicked listener and just try a console.log() within the listener.
I found how to show desktop notification with addon builder for firefox. Like in the below code, but how to show HTML custom notification, google chrome extension can show custom Html notification. Is that possible for Firefox, how?
Here's a typical example. When the message is clicked, a string is logged to the console.
var notifications = require("notifications");
notifications.notify({
title: "Jabberwocky",
text: "'Twas brillig, and the slithy toves",
data: "did gyre and gimble in the wabe",
onClick: function (data) {
console.log(data);
// console.log(this.data) would produce the same result.
}
});
This one displays an icon that's stored in the add-on's data directory. (See the self module documentation for more information.)
var notifications = require("notifications");
var self = require("self");
var myIconURL = self.data.url("myIcon.png");
notifications.notify({
text: "I have an icon!",
iconURL: myIconURL
});
It looks like you've found the current documentation:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/modules/sdk/notifications.html
As stated there, (sorry) HTML content in notifications is not supported in the Add-on SDK.
I'm attempting to place an image map into a jQuery UI dialog. Initially, the and are hidden on the page so that I don't have to do any AJAX. When the dialog is triggered, the and are placed in the dialog and the hidden original content has its link to the image map removed.
There are a few links on the image map in tags and in Firefox, Chrome etc the links are positioned correctly and work.
However, in all versions of IE (the web site is SharePoint 2007 and compatibility mode is on), the links do not fire on the image map. You can hover over the rectangles and be shown the link, but the action never fires.
Code used to initialise below:
$(document).ready(function() {
$('.processDiagram').click(function() {
var phase = $(this).attr('title');
var text = $('#'+phase+' div').html();
var mapname = $('#'+phase+' map').attr('name');
$('#'+phase+' map').attr('name', ''); // null out the background map name so it doesn't get confused
var $dialog = $('<p></p>').html(text).dialog({modal:true, autoOpen:false, width:620, title:phase, beforeClose: function(event, ui) { $('#'+phase+' map').attr('name', mapname); }});
$dialog.dialog('open');
return false; // So firefox won't just follow the link
}
}
I could really do with some help here as I have no idea why the links aren't firing.
Thanks,
Steve
So, the reason is the layout being position:relative does a number on IE, moving all of the hotspots to be relative to the body and not to the image map itself.
Solution is to fix that layout issue.