Skip to content

Commit

Permalink
[all hosts] (Common APIs) Add an isSetSupported sample (#2173)
Browse files Browse the repository at this point in the history
* Add a isSetSupported sample

* Apply suggestions from code review

Co-authored-by: Rick Kirkham <[email protected]>

---------

Co-authored-by: Rick Kirkham <[email protected]>
  • Loading branch information
AlexJerabek and Rick-Kirkham authored Jan 7, 2025
1 parent c92943b commit d5ab219
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/code-snippets/office-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3946,6 +3946,14 @@ Office.PlatformType:enum:
const contextInfo = Office.context.diagnostics;
const platformType: Office.PlatformType = contextInfo.platform;
console.log("Platform: " + platformType);
Office.RequirementSetSupport:interface:
- |-
const requirements : Office.RequirementSetSupport = Office.context.requirements;
if (requirements.isSetSupported('Mailbox', '1.14')) {
// Code that uses APIs from the 'Mailbox 1.14' requirement set.
} else {
// An alternate path (such as a message to the user) when the requirement set isn't supported.
}
Office.Ribbon#requestCreateControls:member(1):
- |-
// Registers a custom contextual tab with Office.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ uid: 'office!Office.RequirementSetSupport:interface'
package: office!
fullName: Office.RequirementSetSupport
summary: Provides information about which Requirement Sets are supported in the current environment.
remarks: ''
remarks: |-
#### Examples
```TypeScript
const requirements : Office.RequirementSetSupport = Office.context.requirements;
if (requirements.isSetSupported('Mailbox', '1.14')) {
// Code that uses APIs from the 'Mailbox 1.14' requirement set.
} else {
// An alternate path (such as a message to the user) when the requirement set isn't supported.
}
```
isPreview: false
isDeprecated: false
type: interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ uid: 'office!Office.RequirementSetSupport:interface'
package: office!
fullName: Office.RequirementSetSupport
summary: Provides information about which Requirement Sets are supported in the current environment.
remarks: ''
remarks: |-
#### Examples
```TypeScript
const requirements : Office.RequirementSetSupport = Office.context.requirements;
if (requirements.isSetSupported('Mailbox', '1.14')) {
// Code that uses APIs from the 'Mailbox 1.14' requirement set.
} else {
// An alternate path (such as a message to the user) when the requirement set isn't supported.
}
```
isPreview: false
isDeprecated: false
type: interface
Expand Down
2 changes: 1 addition & 1 deletion generate-docs/API Coverage Report.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7713,7 +7713,7 @@ Office.RangeFormatConfiguration,"format",Property,Good,false
Office.RemoveHandlerOptions,N/A,Class,Fine,false
Office.RemoveHandlerOptions,"asyncContext",Property,Fine,false
Office.RemoveHandlerOptions,"handler",Property,Good,false
Office.RequirementSetSupport,N/A,Class,Fine,false
Office.RequirementSetSupport,N/A,Class,Fine,true
Office.RequirementSetSupport,"isSetSupported(name, minVersion)",Method,Poor,false
Office.RequirementSetSupport,"isSetSupported(name, minVersionNumber)",Method,Deprecated,false
Office.Ribbon,N/A,Class,Good,false
Expand Down
8 changes: 8 additions & 0 deletions generate-docs/script-inputs/local-repo-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5487,6 +5487,14 @@ Office.PlatformType:enum:
const contextInfo = Office.context.diagnostics;
const platformType: Office.PlatformType = contextInfo.platform;
console.log("Platform: " + platformType);
Office.RequirementSetSupport:interface:
- |-
const requirements : Office.RequirementSetSupport = Office.context.requirements;
if (requirements.isSetSupported('Mailbox', '1.14')) {
// Code that uses APIs from the 'Mailbox 1.14' requirement set.
} else {
// An alternate path (such as a message to the user) when the requirement set isn't supported.
}
Office.Ribbon#requestCreateControls:member(1):
- |-
// Registers a custom contextual tab with Office.
Expand Down

0 comments on commit d5ab219

Please sign in to comment.