Also known as Requirement Sets.

Specifies the minimum requirement set and individual methods used in your add-in.
This overrides the Requirements element in the parent portion of the manifest.

      <bt:Sets DefaultMinVersion="1.3">
         <bt:Set Name="Mailbox"/>
         <bt:Set Name="ExcelApi"/>
         <bt:Set Name="DialogApi"/>
         <Method Name="Document.getSelectedDataAsync"/>

Only use this element to specify critical requirements or API members.
If the office host does not support the requirements the add-in is not displayed in the My Add-ins list (or loaded)
To ensure your add-in is loaded you should use run-time checks instead.

Runtime Checks

The Sets element can contain one or more Set elements.
If the DefaultMinVersion is used it specifies the minimum version for all the child Set elements.

When your add-in depends on a method that is not part of a requirement set use the following runtime check
This will check that the property or function exists first

if (item.somePropertyOrFunction !== undefined){ 
if (Office.context.document.setSelectedDataAsync) {

Check if an object exists

You can use an if statement to determine if the host application supports a given object

if (Office.context.document.customXmlParts) 

Check if a method exists

if (Office.context.document.bindings.addFromPromptAsync) 

Check if the method is undefined

if (Office.context.ui.displayDialogAsync !== undefined) 

Check if an enumeration exists

if (Office.coercionType.Ooxml) 

Office.cast.item.toitemCompose(Office.context.mailboxitem).subject.setAsync("Hello Outlook", 
      function(asyncResult) { event.completed(); });

if (item.itemType === Office.Mailbox.Enums.ItemType.Message) { 

Outlook Add-ins

This element is optional for Outlook add-ins.
You cannot use the Methods element with Outlook add-ins.

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext