Requirements

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.
The Sets element can contain one or more Set elements.

<VersionOverrides> 
   <Requirements>
      <bt:Sets>
         <bt:Set Name="Mailbox" MinVersion="1.3"/>
         <bt:Set Name="ExcelApi" MinVersion="1.3"/>
         <bt:Set Name="DialogApi" MinVersion="1.3"/>
      </bt:Sets>
      <Methods>
         <Method Name="Document.getSelectedDataAsync"/>
      </Methods>
   </Requirements>
</VersionOverrides>

This syntax also works.
If the DefaultMinVersion is used it specifies the minimum version for all the child Set elements.

<Sets DefaultMinVersion="1.3">> 
  <Set Name="Mailbox"/>
  <Set Name="ExcelApi"/>
</Sets>

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

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){ 
   item.somePropertyOrFunction();
}
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.


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