Open kdeclerck opened 1 year ago
I'm still facing this issue. Any pointers in the right direction? 🙏
I'm hitting my head to the same or similar problem after completing these two tutorials:
When I create an email, or an appointment through Web Outlook, the subject gets set (as per the tutorials) + all other stuff works.
This is not the case on Outlook Desktop on Windows 11 (Outlook: 2310 Build 16.0.16924.20054). Event's don't fire... Since adding the 2nd tutorial even the ribbon buttons "Perform an action" and "Show Taskpane" slowed down a lot (~30-60 seconds). Both, the "Performed action" or "Show Taskpane" says "loading..." the 30-60 seconds before showing up.
All the URLs in the manifest are available (from the :3000 webserver), Wef's bundle.js seems to include launchevent.js contents, and the manifest in Wef is the latest one.
This is only thing I get in the log files:
01/11/2023 13:58:24 Unexpected Resource The resource you are trying to use does not exist.
01/11/2023 13:58:24 Unexpected Resource The resource you are trying to use does not exist.
01/11/2023 13:58:24 Unexpected SourceMap Debugging is enabled, but source map file is unavailable. SolutionId=[the id], AppVersion=1.0.0.0
EventViewer for Outlook has an error (@ the same time as above log rows): We're sorry, we couldn't access [Add in name]. Make sure you have a network connection. If the problem continues, please try again later. Add-In ID : [the id]
We also ran into the same issue here. We followed the tutorials but could only get the event-based activation to work on OWA and Outlook for Mac.
Any updates, @exextoc?
@kdeclerck @pepso @bchenhs Are you maybe missing the well-known URI? https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/use-sso-in-event-based-activation#list-allowed-add-ins-in-a-well-known-uri
@kinkoazc my understanding for the well-known URI is to enable SSO for the add in and this is not a pre-requisite to fire events / code for the events. I did try this on the localhost as specified by the article to no avail.
What did happen was that 2 rows of the logs did disappear, but the events are still not firing.
As it stands, the launchevents fire only on Outlook new on desktop and Outlook OWA.
@pepso It could be something event-handler related. Try rewriting/simplifying(& re-adding) them to a format that IE11 engine can process.
@kinkoazc just my thinking as well. I don't know how to make it simpler than what I have thus far though so it gives some input to the desktop Outlook versions (I cannot attach debugger to the old outlook as there's no events being executed):
On Outlook new and OWA I get the code to do what I expect:
Same code and manifest for Desktop old version:
What I can gather the code in commands.js is either not available for execution, does not get executed, or is unable to associate the events for "action" events. Because onAppointmentSend tries to do something this gets just more confusing to me.
bundle.js is all fine loaded into the extension Wef folder with the corresponding manifest so definitely available from the :3000 server.
Event Viewer has a following error message from the second I click "Send" to an event:
We're sorry, we couldn't access DEV Events. Make sure you have a network connection. If the problem continues, please try again later. Add-In ID : de442f6d-5c8d-4eec-b31f-56cd23398561 Error code : 2147500037 Outlook version : 16.0.17425.20176 OS version : PRODUCT_PROFESSIONAL/x64/10.0.22631.3447
It's like some black magic Outlook old cannot access bundle.js file from the temp folder to execute the code which it itself downloads into the temp folder.
Here's the code/manifest I use and my Outlook is build 2403 from April 9th.
commands.js:
Office.onReady();
function action(event) {
console.log("action", event)
const type = Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage;
const id = "random-message-id";
const message = { type, message: "event fired", icon: "Icon.48x48", persistent: false };
Office.context.mailbox.item.notificationMessages.replaceAsync(id, message);
return event.completed();
}
function sendAction(event) {
console.log("sendAction", event)
const response = {allowEvent:false, errorMessage:"sendAction fired"};
return event.completed(response);
}
Office.actions.associate("onAppointmentSend", sendAction);
Office.actions.associate("onNewAppointmentOrganizer", action);
Office.actions.associate("onAppointmentAttachmentsChanged", action);
Office.actions.associate("onAppointmentAttendeesChanged", action);
Office.actions.associate("onAppointmentTimeChanged", action);
Office.actions.associate("onAppointmentRecurrenceChanged", action);
Office.actions.associate("onAppointmentOrganizer", action);
And my manifest.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" xsi:type="MailApp">
<Id>de442f6d-5c8d-4eec-b31f-56cd23398561</Id>
<Version>1.0.1.0</Version>
<ProviderName>DEV</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="DEV Events"/>
<Description DefaultValue="DEV Events Firing."/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-48.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-128.png"/>
<SupportUrl DefaultValue="https://help.support.com"/>
<AppDomains>
<AppDomain>https://localhost:3000</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Mailbox"/>
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.13"/>
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000/commands.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadItem</Permissions>
<Rule xsi:type="ItemIs" ItemType="Appointment" FormType="ReadOrEdit" />
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.13">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<!-- Event-based activation happens in a lightweight runtime.-->
<Runtimes>
<!-- HTML file including reference to or inline JavaScript event handlers.
This is used by Outlook on the web and Outlook on the new Mac UI. -->
<Runtime resid="WebViewRuntime.Url">
<!-- JavaScript file containing event handlers. This is used by Outlook on Windows. -->
<Override type="javascript" resid="JSRuntime.Url"/>
</Runtime>
</Runtimes>
<DesktopFormFactor>
<!-- Enable launching the add-in on the included events. -->
<ExtensionPoint xsi:type="LaunchEvent">
<LaunchEvents>
<LaunchEvent Type="OnAppointmentSend" FunctionName="onAppointmentSend" SendMode="PromptUser" />
<LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="onNewAppointmentOrganizer"/>
<LaunchEvent Type="OnAppointmentAttachmentsChanged" FunctionName="onAppointmentAttachmentsChanged" />
<LaunchEvent Type="OnAppointmentAttendeesChanged" FunctionName="onAppointmentAttendeesChanged" />
<LaunchEvent Type="OnAppointmentTimeChanged" FunctionName="onAppointmentTimeChanged" />
<LaunchEvent Type="OnAppointmentRecurrenceChanged" FunctionName="onAppointmentRecurrenceChanged" />
<LaunchEvent Type="OnAppointmentOrganizer" FunctionName="onAppointmentOrganizer" />
</LaunchEvents>
<!-- Identifies the runtime to be used (also referenced by the Runtime element). -->
<SourceLocation resid="WebViewRuntime.Url"/>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Icon.48x48" DefaultValue="https://localhost:3000/assets/icon-48.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="WebViewRuntime.Url" DefaultValue="https://localhost:3000/commands.html" />
<bt:Url id="JSRuntime.Url" DefaultValue="https://localhost:3000/commands.js" />
</bt:Urls>
</Resources>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>
Found out simplified scenario to test while going back to project generator level...
Creating a new sample project:
yo office
? Choose a project type: Office Add-in Task Pane project
? Choose a script type: JavaScript
? What do you want to name your add-in? messageAddin
? Which Office client application would you like to support? Outlook
? Which manifest type would you like to use? XML manifest
npm start
And the extension works when selecting any email on the inbox just like expected.
Now when doing exactly the same, but repurposing the example to the calendar:
yo office
? Choose a project type: Office Add-in Task Pane project
? Choose a script type: JavaScript
? What do you want to name your add-in? calendarAddIn
? Which Office client application would you like to support? Outlook
? Which manifest type would you like to use? XML manifest
Going into manifest.xml and changing MessageReadCommandSurface to AppointmentOrganizerCommandSurface
npm start
Now, when I open an appointment from the calendar, there's a 60 second delay before the taskpane shows up (says just loading...).
There's also following log row in Office runtime logs: Unexpected Resource The resource you are trying to use does not exist.
.. I also attempted to use https://learn.microsoft.com/en-us/samples/officedev/pnp-officeaddins/outlook-add-in-check-item-categories/ this sample copy and running it has same 60 second delay when attempting to open the taskpane.
@exextoc, or anyone else able to help me to understand what I do wrong? This must be something super obvious like "you are not allowed to use AppointmentOrganizerCommandSurface in old version of the Outlook desktop for windows"?
I'm running into the same issue with Classic Outlook for Windows. The OnMessageSend event in particular is never triggered which results in the UI saying that the add-in is working on request and then it times out. I was able to get the VSCode debugging working with the bundle.js file. The OnMessageSend works fine in New Outlook for Windows and in the browser.
My events for Recipient Changed and On New Compose work every single time.
Try getting the launch event file from webpack without it injecting it's hot relaod code by doing this:
Add this to the devServer section of webpack config:
static: { directory: path.join(__dirname, "dist"), publicPath: "/public", },
And then update the manifest to point to "https://localhost:3000/public/launchevents.js" for the launch event file. This tells webpack to serve up the file unaltered. Hot reload still works on the other files.
Your Environment
The issue
I have a simple Outlook add-in which I generated with the Yeoman generator for Office Add-ins. I configured it for Event-based activation and added the OnMessageSend LaunchEvent. On web this works for me, on Windows it just keeps showing the "Add-in is processing your request" message (which eventually times out) when sending a new email. Note that I'm using the
npm start
command along with the webpack dev server as generated with Yeoman. My app also has commands and a taskpane, this all works fine. In "Office\16.0\Wef{CC8D0873-D4CF-47C8-B66C-9C2A70DF999B}\QWcROHV+7dD0Z+R2KQ6NtA==\Javascript\9566c1b4-341c-4e21-944d-2eb892ecd61e_1.0.0.0_en-US" I do see my bundle.js, which looks fine. I even reduced it to a super simple file. This is the entire file (exactly the same in the cached bundle.js as when requesting https://localhost:3000/launchevent.js):But even with this simple launchevent.js it doesn't fire the event.
This is what my manifest looks like:
These are the logs when I enable runtime logging:
Not sure what
Resource The resource you are trying to use does not exist.
is refering to, I checked all my URLs under<Resources></Resources>
and they all seem available.Any thoughts?