3
votes

According to Microsoft's Office add-in documentation. the Requirements element in the manifest specifies "... the minimum set of JavaScript API for Office requirements that your Office Add-in needs to activate."

I can't figure out the correct place to put that element. The above-linked documentation says Requirements is a child of OfficeApp, but the Seller Dashboard and the manifest validator both say that is incorrect:

Details: The element 'OfficeApp' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1' has invalid child element 'Requirements' in namespace 'http://schemas.microsoft.com/office/appforoffice/1.1'. List of possible elements expected: any element in namespace 'http://www.w3.org/2000/09/xmldsig#'.

All the docs I've read, SO questions, etc., only include snippets like:

<Requirements>
    <Sets DefaultMinVersion="1.1">
        <Set name="WordApi" />
        <Set name="ExcelApi" />
    </Sets>
</Requirements>

But those snippets do not say under what parent to use <Requirements>.

Where does Requirements go in an Office add-in manifest file?

1

1 Answers

3
votes

The <Requirements> element comes after <Hosts> and before <DefaultSettings>.

I got this by noting that:

  • <Hosts> is the last element in the sequence of <OfficeApp> children (schema link)
  • <Requirements> is the first element in a subsequently-defined extension to` (schema link)
  • XML schema <extension> elements always append to the base element being extended (see, e.g., this SO answer)

I tested this by putting <Requirements> in various places in the file. Putting <Requirements> after <Hosts> and before <DefaultSettings> was the only placement that worked. (Putting <Requirements> as the first child did not work.)

Thanks to user Rick Kirkham, whose now-deleted answer pointed me to the schema definition.