OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
683 stars 95 forks source link

`OnNewAppointmentOrganizer` not working for Windows & Web browser #4279

Open andreyvcita opened 7 months ago

andreyvcita commented 7 months ago

OnNewAppointmentOrganizer triggered only for Outlook Mac (New UI) and not working for Windows & Web browser

andreyvcita commented 7 months ago
Screenshot 2024-03-20 at 13 29 19

looks like Add-in not displaying for Calendar

shighosh-msft commented 7 months ago

Hi @andreyvcita, do you mean your custom add-in is not displayed on the Calendar surface? Can you share a sample manifest that we can use to repro this issue?

andreyvcita commented 7 months ago

@shighosh-msft yes, custom Add-in insert signature, and it works well for Mac Outlook for Calendar as in video

Part of manifest what related to triggers:

<ExtensionPoint xsi:type="LaunchEvent">
       <LaunchEvents>
            <LaunchEvent Type="OnNewMessageCompose" FunctionName="func" />
            <LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="func" />
            <LaunchEvent Type="OnMessageFromChanged" FunctionName="func" />
        </LaunchEvents>
        <SourceLocation resid="Autorun" />
</ExtensionPoint>

https://github.com/OfficeDev/office-js/assets/61542122/05fb8ba2-74f2-4c67-8e53-915a32b35ba8

BUT not working in windows and web, for web I can't see console logs it looks like OnNewAppointmentOrganizer was never triggered

shighosh-msft commented 7 months ago

@andreyvcita - this is not a repro for us, we can still see OnNewAppointmentOrganizer being triggered as expected in Outlook Web.

Can you please collect HAR files (network log) and provide a sample manifest and send them across for further debugging? Plase upload the files to a private github repo and give access to @exextoc

Also, while collecting logs on Outlook Web, please ensure that you start collecting the log before the app is laoded / refreshed.

andreyvcita commented 7 months ago

Screenshot 1

Screenshot 2024-03-22 at 12 42 49

and in calendar I can't see add-in sources (Screenshot 1)

Manifest:

<?xml version="1.0" encoding="UTF-8"?>
<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" xsi:type="MailApp">
  <Id></Id>
  <Version>1</Version>
  <ProviderName>add in</ProviderName>
  <DefaultLocale>en-us</DefaultLocale>
  <DisplayName DefaultValue="add in"/>
  <Description DefaultValue="add in"/>
  <IconUrl DefaultValue=""/>
  <HighResolutionIconUrl DefaultValue=""/>
  <SupportUrl DefaultValue=""/>

  <Requirements>
    <Sets DefaultMinVersion="1.5">
      <Set Name="Mailbox" />
    </Sets>
  </Requirements>

  <!-- Old schema. This will be overridden by the VersionOverrides below. -->
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue=""/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>
  <Permissions>ReadWriteItem</Permissions>
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
  </Rule>
  <DisableEntityHighlighting>true</DisableEntityHighlighting>
  <!-- /Old schema. -->

  <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">
      <Description resid="residAppDesc" />

      <Requirements>
        <bt:Sets DefaultMinVersion="1.5">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>

      <Hosts>
        <Host xsi:type="MailHost">
        <!-- Specify the runtime for event-based activation. -->
        <!-- For more information, see https://docs.microsoft.com/office/dev/add-ins/outlook/autolaunch -->
          <Runtimes>
            <Runtime resid="Autorun">
              <Override type="javascript" resid="runtimeJs"/>
            </Runtime>
          </Runtimes>

          <DesktopFormFactor> 
            <SupportsSharedFolders>true</SupportsSharedFolders>
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="mccsG0">
                  <Label resid="residGL0"/>
                  <Control xsi:type="Button" id="MRCS_TpBtn0">
                    <Label resid="residStr0"/>
                    <Supertip>
                      <Title resid="residStr0" />
                      <Description resid="residTT0" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon16x16" />
                      <bt:Image size="32" resid="Icon16x16" />
                      <bt:Image size="80" resid="Icon16x16" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="residUrl0"/>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>

            <!-- Specify function to call for new message and new appointment events -->
            <ExtensionPoint xsi:type="LaunchEvent">
              <LaunchEvents>
                <LaunchEvent Type="OnNewMessageCompose" FunctionName="runFunc" />
                <LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="runFunc" />
                <LaunchEvent Type="OnMessageFromChanged" FunctionName="runFunc" />
              </LaunchEvents>
              <SourceLocation resid="Autorun" />
            </ExtensionPoint>

          </DesktopFormFactor>

          <MobileFormFactor>            
            <ExtensionPoint xsi:type="LaunchEvent">
              <LaunchEvents>
                <LaunchEvent Type="OnNewMessageCompose" FunctionName="runFunc"/>
              </LaunchEvents>

              <SourceLocation resid="Autorun"/>
            </ExtensionPoint>
          </MobileFormFactor>

        </Host>
      </Hosts>
      <Resources>
        <bt:Images>
          <bt:Image id="Icon16x16" DefaultValue=""></bt:Image>
        </bt:Images>
        <bt:Urls>
          <bt:Url id="residMobileUrl0" DefaultValue=""></bt:Url>
          <bt:Url id="residUrl0" DefaultValue=""></bt:Url>
          <bt:Url id="Autorun" DefaultValue=""></bt:Url>
          <bt:Url id="runtimeJs" DefaultValue=""></bt:Url>
        </bt:Urls>
         <bt:ShortStrings>
          <bt:String id="residGL0" DefaultValue="add in"></bt:String>
          <bt:String id="residStr0" DefaultValue="Settings"></bt:String>
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="residAppDesc" DefaultValue="add in"></bt:String>
          <bt:String id="residTT0" DefaultValue="add in"></bt:String>
        </bt:LongStrings>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>
Pylartes commented 7 months ago

Hi :) We are developing an add-In for outlook and we have the same issue since last week in Windows/Edge/Outlook Web. Before it worked as expected, but now the event no longer triggers my function. I've also tried to console.log but nothing came back, are there any update on this?

manifest:

         <ExtensionPoint xsi:type="LaunchEvent">
            <LaunchEvents>
              <LaunchEvent Type="OnNewAppointmentOrganizer" FunctionName="onNewAppointmentOrganizer" />
              <LaunchEvent Type="OnAppointmentOrganizer" FunctionName="onAppointmentOrganizer" />
            </LaunchEvents>
            <SourceLocation resid="WebViewRuntime.Url"/>
          </ExtensionPoint>

launchevent:

function onNewAppointmentOrganizer() {
  console.log("onNewAppointmentOrganizer");
}

function onAppointmentOrganizer() {
  console.log("onAppointmentOrganizer");
}

Office.actions.associate("onNewAppointmentOrganizer", onNewAppointmentOrganizer);
Office.actions.associate("onAppointmentOrganizer", onAppointmentOrganizer);
akagarwa-msft commented 7 months ago

We are not able to repro the issue at our end. Can you please collect HAR files (network log) and provide a sample Addin and send them across for further debugging? Please upload the files to a private github repo and give access to @exextoc.

exextoc commented 7 months ago

@andreyvcita, your manifest looks fine. Do you have runtime logging enabled for Windows Outlook? If so, can you share the logs? If not, can you try removing all the code in your JavaScript file and simply replace it with the code below, just as a test to see if Outlook is able to process very basic code:

function onNewAppointmentOrganizer() {
  console.log("onNewAppointmentOrganizer - " + (new Date()).toString());
}

Office.actions.associate("OnNewAppointmentOrganizer", onNewAppointmentOrganizer);

The console.log output will go into the runtime logs. To setup runtime logging, add a reg-key named RuntimeLogging under HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Wef\Developer\

Double-click on the Default value and set it to the path to a text file for the logs to hold the logs.

Step-by-step instructions can be found here: https://learn.microsoft.com/en-us/office/dev/add-ins/testing/runtime-logging#runtime-logging-on-windows

Share the content of runtime logs when you get a chance. Feel free to redact it before sharing.

JuaneloJuanelo commented 7 months ago

@andreyvcita it would have been wonderful if you used the template to report this issue, you are missing some important information. In what versions if Windows you are getting this issue? can you please share that detail? thanks!

Pylartes commented 7 months ago

@akagarwa-msft Unfortunately I cannot share our add-in, we are still under development and it wouldn't work for you without our backend.

My problem is also not in the Outlook client (Not tried) but directly when calling https://outlook.office.com in Edge (Version 122.0.2365.52 (64-Bit), so runtime logging will probably not help. (I have at least activated it, but it does not record any Edge-related entries. Entries do come in when I start the desktop client though, so I think I've set it up correctly).

I don't want to hijack the post, but if I can help in any way to solve or clarify the problem let me know.

rajjha-msft commented 7 months ago

Hey @Pylartes

andreyvcita commented 7 months ago

Hi, I appreciate for your help.

looks like it work after I added Office.actions.associate("onNewAppointmentOrganizer", onNewAppointmentOrganizer);

but I have another issue:

for New Appointment in Outlook Web setSignatureAsync is not supported

logs: The operation is not supported.

Should I use setAsync function for this case?

rajjha-msft commented 7 months ago

Hey @andreyvcita

Thanks for confirming that the issue has started to work for you. Please feel free to create another issue for additional challenges you're facing around Office-Js Apis.

Pylartes commented 7 months ago

Hey @rajjha-msft :) I've created a fresh add-in with the yeoman generator and added the launchevents, like you've asked. And ... I got log entries in the console...

I still have no idea why the events in our add-In are no longer working (we haven't changed the code at that part in the last few weeks and it worked perfectly fine before) but it's obviously not from your side.

Sorry for the fuss and thank you very much for your support!