OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
152 stars 93 forks source link

Invalid error: Mailbox add-in manifest contains ItemSend event in VersionOverrides which is not allowed. #613

Closed jfoclpf closed 1 year ago

jfoclpf commented 2 years ago

Expected behavior

This valid manifest file taken by your example should be correctly validated by office-addin-manifest validate.

ItemSend event is valid inside VersionOverrides.

Current behavior

It's throwing an error:

Error #2:
Mailbox add-in containing ItemSend event is invalid.: Mailbox add-in containing ItemSend event is invalid.
  - Details: Mailbox add-in manifest contains ItemSend event in VersionOverrides which is not allowed.

The manifest is not valid.

Steps to Reproduce

  1. create this valid manifest file and name it manifest_dev.xml
  2. run: npx office-addin-manifest validate manifest_test.xml
  3. Invalid error: Mailbox add-in manifest contains ItemSend event in VersionOverrides which is not allowed.

Context

In the context of creating an ItemSend Event for an Outlook Appointment.

Failure Logs

We are using this manifest which also fails with Mailbox add-in manifest contains ItemSend event in VersionOverrides which is not allowed.

<?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>90992a37-6ac0-4e31-8f4d-c35d61ac033b</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>CKT (dev)</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>

  <DisplayName DefaultValue="Sync events with CKT Portal (dev)"/>

  <Description DefaultValue="Sync events of Outlook with CKT portal (dev)"/>

  <IconUrl DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/ckt.gif"/>
  <HighResolutionIconUrl DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/ckt-128x128.gif"/>
  <SupportUrl DefaultValue="https://ckt-d.internal.epo.org"/>

  <AppDomains>
    <AppDomain>https://ckt-d.internal.epo.org</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Mailbox"/>
  </Hosts>

  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1"/>
    </Sets>
  </Requirements>

  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/taskpane.html"/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteMailbox</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Edit" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
  </Rule>

  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <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.8">
          <bt:Set Name="Mailbox"/>
        </bt:Sets>
      </Requirements>

      <Hosts>
        <Host xsi:type="MailHost">
          <DesktopFormFactor>
            <FunctionFile resid="Taskpane.Url"/>
            <ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="apptComposeDemoGroup">
                  <Label resid="groupLabel" />
                  <!-- Task pane button -->
                  <Control xsi:type="Button" id="TaskpaneButton">
                    <Label resid="TaskpaneButton.Label" />
                    <Supertip>
                      <Title resid="TaskpaneButton.Label" />
                      <Description resid="TaskpaneButton.Tooltip" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon.16x16" />
                      <bt:Image size="32" resid="Icon.32x32" />
                      <bt:Image size="80" resid="Icon.80x80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Taskpane.Url" />
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>
            <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="apptReadDemoGroup">
                  <Label resid="groupLabel" />
                  <!-- Task pane button -->
                  <Control xsi:type="Button" id="TaskpaneButton2">
                    <Label resid="TaskpaneButton2.Label" />
                    <Supertip>
                      <Title resid="TaskpaneButton2.Label" />
                      <Description resid="TaskpaneButton2.Tooltip" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="Icon.16x16" />
                      <bt:Image size="32" resid="Icon.32x32" />
                      <bt:Image size="80" resid="Icon.80x80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Taskpane.Url" />
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>
            <ExtensionPoint xsi:type="Events">
              <Event Type="ItemSend" FunctionExecution="synchronous" FunctionName="validateSubjectAndCC" />
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>

      <Resources>
        <bt:Images>
          <bt:Image id="Icon.16x16" DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/ckt.gif"/>
          <bt:Image id="Icon.32x32" DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/ckt-32x32.gif"/>
          <bt:Image id="Icon.80x80" DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/ckt-80x80.gif"/>
        </bt:Images>
        <bt:Urls>
          <bt:Url id="Taskpane.Url" DefaultValue="https://ckt-d.internal.epo.org/addins/outlook/taskpane.html"/>
        </bt:Urls>
        <bt:ShortStrings>
          <bt:String id="groupLabel" DefaultValue="CKT Add-in (dev)"/>
          <bt:String id="TaskpaneButton.Label" DefaultValue="CKT (dev)"/>
          <bt:String id="TaskpaneButton2.Label" DefaultValue="CKT (dev)"/>
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="TaskpaneButton.Tooltip" DefaultValue="Sync Outllook events with CKT as Organizer (dev)"/>
          <bt:String id="TaskpaneButton2.Tooltip" DefaultValue="Sync Outllook events with CKT as Attendee (dev)"/>
        </bt:LongStrings>
      </Resources>

    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>
jfoclpf commented 2 years ago

Just to be sure, I just tried now with node v14.18.0 and v16.14.0 and I get the same error

cut2run commented 2 years ago

We have the same error with our manifest as well. I am not going to publish it as it is similar to the manifest posted. The main point it uses the Extention point "Event". Please note, the manifest still can be installed onto O365 mailbox.

exextoc commented 2 years ago

Add-ins with On-Send events are not allowed on the add-in store. They can only be installed by the organization admin or manually.

jfoclpf commented 2 years ago

Add-ins with On-Send events are not allowed on the add-in store. They can only be installed by the organization admin or manually.

I am installing it manually.

But the main point is: why is office-addin-manifest validate throwing an error when the manifest is totally valid?

cut2run commented 2 years ago

I would like to add to the point. What is office-addin-manifest validation tool? Is this tool which validates manifest against of requirements of the Office store or the tool which validates against all known VersionOverrides schemas? As the developer, I would be interested if my manifest validated against all schemas. If I will submit my manifest to the Office store, they will provide me with detailed results and I will react accordingly. Even a better idea to have your tool the command line switch to do the full validation or validation for the Office store.

millerds commented 2 years ago

The tool does the same validation as the add-in store minus the dev inner loop urls (full store validation would flag the use of 'localhost'). If some things are not allowed in the store but are allowed locally (other than 'localhost'), then it's going to flag those. It would be a nice feature add to be able to designate which type of validation to do.

exextoc commented 2 years ago

@jfoclpf We have updated the documentation accordingly. Kindly refer to https://docs.microsoft.com/en-us/office/dev/add-ins/testing/troubleshoot-manifest

jfoclpf commented 2 years ago

Nice, I realise now we may use an extra -p option when we want to validate for the store

npx office-addin-manifest validate -p MANIFEST_FILE

But now I have a question: you mention xmllint to validate against the xml schema. But office-addin-manifest does not do that also already?

exextoc commented 2 years ago

@millerds Can you please answer above follow-up query from @jfoclpf ? Thanks.

millerds commented 2 years ago

The tool calls a service endpoint (which is also used by the store) and we just report the results . . . I do not know the details of how it validates the manifest.

jfoclpf commented 2 years ago

I mean, the manifest already provides the schema, for example at http://schemas.microsoft.com/office/appforoffice/1.1

I was wondering if office-addin-manifest validate would already do that without the need of xmllint

millerds commented 2 years ago

I get that . . . but it would be up to the service we call to take care of that as it is not something directly done in the tool (which just reports the service call results).

mkondadg commented 2 years ago

I get the same error when I validate it. The problem for me is that, I am able to sideload the addin using manifest.xml manually but the same xml when deployed using Microsoft Admin Console says "invalid manifest file" like below.

jira-generated-image-static-26f4a68f-5cf6-43b8-9cd7-d34d43578995

Is there any way to know what the exact problem is ?

mkondadg commented 2 years ago

I get the same error when I validate it. The problem for me is that, I am able to sideload the addin using manifest.xml manually but the same xml when deployed using Microsoft Admin Console says "invalid manifest file" like below.

jira-generated-image-static-26f4a68f-5cf6-43b8-9cd7-d34d43578995

Is there any way to know what the exact problem is ?

The validation error from command (npm run validate) is

Mailbox add-in containing ItemSend event is invalid.: Mailbox add-in containing ItemSend event is invalid. (link: undefined)
  - Details: Mailbox add-in manifest contains ItemSend event in VersionOverrides which is not allowed.
mkondadg commented 2 years ago

When we added below fields, the addin was loaded successfully from Microsoft Admin Console in spite of validation failure.

  <IconUrl DefaultValue="https://icons.iconarchive.com/icons/ampeross/qetto/64/icon-developer-icon.png"/>
  <HighResolutionIconUrl DefaultValue="https://icons.iconarchive.com/icons/ampeross/qetto/128/icon-developer-icon.png"/>
  <SupportUrl DefaultValue="https://docs.microsoft.com/office/dev/add-ins/overview/office-add-in-code-samples"/>
millerds commented 1 year ago

Looks like the main issue has been explained. If there is a feature suggestion for the tools, please suggest (and up vote) at https://aka.ms/M365dev-suggestions