OfficeDev / Office-Addin-TaskPane-React

Template to get start started writing a TaskPane Office Add-in for the React framework using TypeScript
Other
53 stars 34 forks source link

Add-in only works when I click on "new email" #134

Closed JokerMarwan closed 9 months ago

JokerMarwan commented 9 months ago

[Enter feedback here]


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AlexJerabek commented 9 months ago

@samantharamon, could you please investigate?

samantharamon commented 9 months ago

Hi @JokerMarwan,

Thanks for reaching out. When you say that the add-in only works when you click on New Email, do you mean that the add-in button appears in the ribbon of the new email window or the add-in appears in the ribbon of the message read surface only after selecting New Email?

I tested this in the Outlook on Windows client and the add-in works as expected. Please note that after sideloading the add-in through the npm start command, it may take a few seconds for the add-in to appear in the Outlook ribbon. You may also need to restart the Outlook client to see the add-in.

JokerMarwan commented 9 months ago

Hey, yes that's exactly what I mean the button only appears in the message tab. this happens when I generate the add-in using Yeomen generator using React frame work and typescript, I checked the rules tab in the xml file and it was set to read. this happens both on Old and new outlook, this started happening when the new template was introduced. another error would also show is when I run the add-in:

Error: Unable to start debugging. Error: Unable to sideload the Office Add-in. Error: Unable to set registry value "befae08f-eac9-4389-98ca-707aee400cc8" to "My/relative/path" (REG_SZ) for key ""HKCU\SOFTWARE\Microsoft\Office\16.0\Wef\Developer"". ProcessUncleanExitError: ADD command exited with code 1: ERROR: Invalid syntax. Type "REG ADD /?" for usage.

Rick-Kirkham commented 9 months ago

@JokerMarwan This is expected behavior with the new template. The add-in is only available in the compose message window. Note the following from the manifest, including the comments.

  <!-- The <Rule> element is required for validation, but is ignored when there is a <VersionOverrides> element. -->
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
  </Rule>
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <!-- The <Hosts> element is required for validation, but it is ignored when there there is a child <VersionOverrides> element of type VersionOverridesV1_1 with its own <Hosts> element. -->
    <Hosts>
      <Host xsi:type="MailHost">
      </Host>
    </Hosts>
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Requirements>
        <bt:Sets DefaultMinVersion="1.3">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <DesktopFormFactor>
            <FunctionFile resid="Commands.Url" />
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">

The <Rule> element has to be there, but it has no effect because it is overridden by the <ExtensionPoint xsi:type="MessageComposeCommandSurface"> element which specifies that the add-in is only available in the message compose surface.

I can reproduce the command line error. It doesn't seem to prevent the add-in from loading and running, but I will investigate it.

@samantharamon I'm going to try and move this to the repo for the React TypeScript template and reassign it to myself.

Rick-Kirkham commented 9 months ago

@JokerMarwan The command line error was a bug introduced last week in one of the tools that gets installed with a Yo Office project. It has now been fixed. If I reinstall Yo Office, I can no longer reproduce it.

millerds commented 9 months ago

Actually . . . looks like a bug in the newest version of 'winreg' which is a nested decency of the tools used in these projects. It's still there. I will be updating our tool to use a specific version of winreg that still works. Thanks for point this out.