Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated spam-reporting add-in: Office.context undefined #4411

Closed
navmro opened this issue Apr 29, 2024 · 8 comments
Closed

Integrated spam-reporting add-in: Office.context undefined #4411

navmro opened this issue Apr 29, 2024 · 8 comments
Assignees
Labels
Area: Outlook Issue related to Outlook add-ins

Comments

@navmro
Copy link

navmro commented Apr 29, 2024

Provide required information needed to triage your issue

Now that the feature for "integrated spam-reporting add-in" is also in preview for the new Outlook we're trying to have it work there. The plugin appears, the popup appears, but then timeout due to an undefined variable.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC desktop
  • Host [Excel, Word, PowerPoint, etc.]: New Outlook
  • Office version number: 1.2024.417.100 (Production). Client Version is 20240419007.16 .
  • Operating System: Windows 10 22H2 19045.4291
  • Browser: Chrome 124.0.6367.63

Expected behavior

After the popup appears when the user report an email, the "onSpamReport" callback should be called.

Current behavior

In the new Outlook on Windows, the popup appears, but when the button is clicked it spins until timeout:

Opening the plugin in the web version on https://outlook.office.com/ (not my targeted environment).
We can see an error in the debugger when the button is pressed:

"Cannot read properties of undefined"
For Office.context.platform

The bit of code where the error is come from the plugin :
https://github.com/OfficeDev/Office-Add-in-samples/blob/main/Samples/outlook-spam-reporting/src/spamreporting.js#L41
And from the documentation:
https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/spam-reporting#implement-the-event-handler

Steps to reproduce

I've used both the Sample "integrated spam-reporting addin":

  1. Deploy https://github.com/OfficeDev/Office-Add-in-samples/tree/main/Samples/outlook-spam-reporting
  2. Open new Outlook
  3. Press the button to report an email as spam
  4. Press the "Report button" in the popup

Or my sample plugin (https://github.com/navmro/antiphishing) which is just following documentation:

  1. Create a new Outlook plugin with "yo office"
  2. Follow the documentation from : https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/spam-reporting
  3. npm start
  4. Press the button to report an email as spam
  5. Press the "Report button" in the popup

Both have the same code, coming from the documentation.

Provide additional details

  1. I've enabled "EnableBetaAPIsInJavaScript" to 1 in HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\WebExt\Developer
  2. I've tried with the user or with the whole tenant in "targeted release" in the M365 console

Removing the if (Office.context.platform === ... check allows the plugin to move forward, the callback is called. But then fails later with an error: Error encountered during message processing: The operation is not supported. from:
https://github.com/OfficeDev/Office-Add-in-samples/blob/main/Samples/outlook-spam-reporting/src/spamreporting.js#L14
I've not investigated that yet.

Context

We're trying to replace our existing VSTO spam-reporting addin with a new one that would work in the new Outlook.

The new JS plugin works on the old outlook desktop app, but not in the new Outlook desktop app.

Useful logs

The logs on chrome were already provided above.

For the new Outlook on desktop, no logs were found in the event viewer. Despite the documentation mentionning to check there:
https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/troubleshoot-event-based-and-spam-reporting-add-ins
Is the event viewer the correct places for logs on the new Outlook on desktop ?

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Apr 29, 2024
@exextoc exextoc added Needs: attention 👋 Waiting on Microsoft to provide feedback Area: Outlook Issue related to Outlook add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Apr 30, 2024
@exextoc exextoc self-assigned this Apr 30, 2024
@neprasad-microsoft
Copy link

Hi @navmro
Please follow the steps here for new Outlook to collect the logs - https://github.com/OfficeDev/office-js/wiki/Collecting-log-files-for-Outlook-Add%E2%80%90ins-issues
You can host it in a private repo and give access to exextoc.

@neprasad-microsoft neprasad-microsoft added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Apr 30, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Status: no recent activity Issue or PR is stale (no recent activity) label May 5, 2024
@navmro
Copy link
Author

navmro commented May 6, 2024

Hi @neprasad-microsoft
Thank you, I've collected logs for the new Outlook.
Here is the repository only available for exextoc:
https://github.com/navmro/outlook-logs

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Status: no recent activity Issue or PR is stale (no recent activity) Needs: author feedback Waiting for author (creator) of Issue to provide more info labels May 6, 2024
@mmanjaree-msft
Copy link

@navmro Could you please confirm if the issue is still reproable. We fixed an issue with the sample addins recently.

@navmro
Copy link
Author

navmro commented May 13, 2024

@mmanjaree-msft I can see that new Outlook updated. I'm on version 1.2024.501.300 (Production).

The error I get now is :

Error encountered during message processing: The operation is not supported.

From the code at line 24 :
https://github.com/OfficeDev/Office-Add-in-samples/blob/main/Samples/outlook-spam-reporting/src/spamreporting.js#L24

It looks like the getAsFileAsync is not working, but I have the registry key set-up:

reg query HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\WebExt\Developer

  HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Outlook\Options\WebExt\Developer
  EnableBetaAPIsInJavaScript    REG_DWORD    0x1

I've uploaded a new extract from the console + the har on github for exextoc:
issue_4411b_operation_not_supported.txt
issue_4411b_operation_not_supported.zip

@mmanjaree-msft
Copy link

The integrated spam reporting feature is still getting rolled out in outlook web and so it might not be fully available as mentioned in doc https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/spam-reporting#preview-the-integrated-spam-reporting-feature. It is in preview in classic outlook on windows and outlook on mac

@navmro
Copy link
Author

navmro commented May 14, 2024

The current problem seems to be with the GetAsFileAsync feature, which is supposed to be in preview on the new outlook:
https://learn.microsoft.com/en-us/javascript/api/requirement-sets/outlook/preview-requirement-set/outlook-requirement-set-preview?view=common-js-preview#officecontextmailboxitemgetasfileasync

Available in: Outlook on Windows (Microsoft 365 subscription), Outlook on Mac (Microsoft 365 subscription), Outlook on the web (modern), new Outlook on Windows (preview)

I know it's not fully ready yet, that's why I'm testing it and reporting bugs I find.

@mmanjaree-msft
Copy link

@navmro Please refresh owa and confirm if its working for you now

@navmro
Copy link
Author

navmro commented May 16, 2024

@mmanjaree-msft I confirm that it works on owa.
I can also confirm that I don't get the error in new outlook anymore.

Thank you very much :)

@navmro navmro closed this as completed May 16, 2024
@exextoc exextoc removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins
Projects
None yet
Development

No branches or pull requests

4 participants