Comments (13)
I'm going to forward this issue to the Mac and OWA group.
For Script Lab not working in OWA please see this:
OfficeDev/script-lab#1037 (comment)
from office-js.
Success! That works. My apologies for missing the change to innerText
before. It's still curious to me that it works in one place and not others, but this issue closed.
from office-js.
I feel like something may be missing from these repro steps. (especially if it repros across all platforms) Can you try Script Lab (installable through the App Store) to make sure it works?
Is there anything special about the email or the account that you are testing with?
I was able to get it working in Classic Windows Outlook. (are you on "old" outlook or "new" outlook?)
$("#run").on("click", run);
function run() {
console.log(Office.context.mailbox.item.internetMessageId);
}
from office-js.
Thank you. AFAIK, the Outlook versions are all "new." The macOS was installed a few weeks ago, the Windows version just last week. (I'm not concerned with "old" Outlook. That supports our old add-ins which have been in use for years.)
Since running the modified add-in demo, my Outlook inbox received another email (sent from out corporate mail server using Mozilla's Thunderbird on macOS Sonoma 14.4.1). The modified add in shows the Message-ID for that email, but on no others--two from GMail in a browser, one from [email protected] (about upcoming subscription renewal), nor one I sent this morning from macOS Mail v16.0 (3774.500.171.1.1) through our corporate mail server. Your ScriptLab sample works for all emails with macOS Outlook. I've tried to test it in with Outlook for web, but today the add-in will not load despite repeated attempts to clear cache, reload, restart the dev server, etc.
Since the modified add-in demo works in one email but not others, I still believe there is a problem with office.js. As for Outlook for web, my attempts using it with demos fail more often than work. I can't believe that it's truly ready for production. (At best, I find it nearly useless for development and testing.)
from office-js.
@johnthad We could not repro the issue in mac outlook and owa. In case scriptlab is not working, could you try executing this -console.log(Office.context.mailbox.item.internetMessageId) in console after switching to your add-in frame and check if you see internetMessageId for all types of mails you mentioned
from office-js.
@timwan10 - Thanks for the tip about disabling Third Party Storage Partitioning. ScriptLabs now loads for me in Chrome (BTW, it's a nice tool). Would disabling Third Party Storage Partitioning be a user requirement for other add-ins, should we ever write one? (Someone might consider a note about this in the docs. It's far more helpful than references to IE11.)
@mmanjaree-msft - The console trick works. Thanks. As for my code demo, below is my taskpane.js
. You can see that it is word-for-word identical to the taskpane.js
in the Outlook quick start except for changing item.subject
to item.internetMessage
. I'm at a loss to understand why this change works for only one out of five emails in my Outlook inbox on both the macOS client and Outlook Web in Chrome.
/*
* Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
* See LICENSE in the project root for license information.
*/
/* global document, Office */
Office.onReady((info) => {
if (info.host === Office.HostType.Outlook) {
document.getElementById("sideload-msg").style.display = "none";
document.getElementById("app-body").style.display = "flex";
document.getElementById("run").onclick = run;
}
});
export async function run() {
// Get a reference to the current message
const item = Office.context.mailbox.item;
// Write message property value to the task pane
document.getElementById("item-subject").innerHTML = "<b>Subject:</b> <br/>" + item.internetMessageId;
}
from office-js.
@johnthad Just to confirm. With api call in console, you are able to get internetMessageId but with this sample addin you see a blank.
Could you check for any errors in console specially if item itself is undefined. Close the taskpane and open and see if it works. Also share a repro video if possible
from office-js.
The DevTools console in Chrome is simple awash with red when I run Outlook in the browser. I've attached a log for a session and do not find the word "undefined" in a text search. In this session I open Outlook in chrome and run the add-in against several emails in the Inbox. Only one email shows its internetMessageId
.
outlook.office.com-1716213574272.log
A video matching the creation of this log is at https://www.dropbox.com/scl/fi/1tntcza5tfadwyuc2n2v4/Screen-Recording-2024-05-20-at-09.57.51.mov?rlkey=p993obmebji7dsp6qe5cu0lw8&st=jmhjz783&dl=0
from office-js.
Thank you for bringing this to our attention. Based on the information you've provided; it appears that the issue may not be related to the platform as it works fine when called from Dev-Tools console.
We kindly suggest that you review the add-in code and investigate why it may not be functioning as expected. Please note that our support is limited to Office-Js related issues. We appreciate your understanding and cooperation in this matter.
from office-js.
I have reviewed the add-in's code. Presumably, Microsoft has also reviewed the add-in's code since it's Microsoft's example. As stated when opening this issue, the example is the Build your first Outlook add-in using the Yeoman generator, and changing one word. It appears there are circumstances where office.js
is not finding internetMessageId
in emails although it exists. I'd like to understand what those circumstances, and what can be done as a workaround.
from office-js.
@johnthad The issue here seems related to the format of the internetMessageId which is enclosed in <>. The value is being assumed as a HTML tag and hence, not being displayed in taskpane. Could you please try updating the js code as below and see if the id populates correctly.
document.getElementById("item-subject").innerText = "<b>Subject:</b> <br/>" + item.internetMessageId;
from office-js.
No change. The internetMessageID
displays on only the same email as before.
I removed the HTML markup from around the word "Subject:", changing line #21 from
document.getElementById("item-subject").innerHTML = "<b>Subject:</b> <br/>" + item.internetMessageId;
to
document.getElementById("item-subject").innerHTML = "Subject: " + item.internetMessageId;
I launch macOS Outlook and reset the account. I can see that "Subject:" is no longer in bold face but the internetMessageID
still displays on only the same email as before. It fails to appear elsewhere, including a new email received yesterday from [email protected]
confirming the renewal of my Exchange Online (Plan 1) subscription.
from office-js.
@johnthad You just need to change "innerHTML" to "innerText" and keep the remaining code as it is. Could you please try that?
from office-js.
Related Issues (20)
- Outlook 365 add-in not loading on MAC/OS new Outlook app. HOT 8
- Powerpoint Add-in is not updating automatically without any notification HOT 5
- Custom function handling of Entity Value is broken again HOT 6
- Office.context.roamingSettings.get() size limit HOT 2
- Word close API not working HOT 6
- Excel close is not working HOT 10
- Powperpoint close API HOT 6
- Manifest file sideloads on Excel web but does not sideload on Mac or Windows os HOT 2
- Opening dialog in iframe for an Excel custom function handler fails on alternate invocations HOT 6
- Outlook Add-in - Call to mailbox.getUserIdentityTokenAsync returning undefined token for only some Outlook accounts HOT 12
- Assistance Needed with Outlook Add-In installing Manifest for older version of Outlook HOT 4
- MIME parts returned by getAsFileAsync() don't include Content-Disposition on Outlook Win32 HOT 1
- Permission under manifest file HOT 5
- Content copy pasted as table not being considered as body text using getAsync(Office.CoercionType.Text) HOT 5
- categories.addAsync is failing with operation not supported error in new outlook in windows HOT 2
- Outlook add-ins are not working for a Gmail account. HOT 1
- displayMessageFormAsync does not work in Mac HOT 1
- Way to turn off track changes from office documents HOT 9
- Create Presentation/Excel API HOT 3
- Highlight custom tab on opening document HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from office-js.