From d5ab21947663e61fc7dd0eab3f2d9fed726e7ea5 Mon Sep 17 00:00:00 2001 From: Alex Jerabek <38896772+AlexJerabek@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:28:41 -0800 Subject: [PATCH] [all hosts] (Common APIs) Add an isSetSupported sample (#2173) * Add a isSetSupported sample * Apply suggestions from code review Co-authored-by: Rick Kirkham --------- Co-authored-by: Rick Kirkham --- docs/code-snippets/office-snippets.yaml | 8 ++++++++ .../office/office/office.requirementsetsupport.yml | 14 +++++++++++++- .../office/office.requirementsetsupport.yml | 14 +++++++++++++- generate-docs/API Coverage Report.csv | 2 +- .../script-inputs/local-repo-snippets.yaml | 8 ++++++++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/docs/code-snippets/office-snippets.yaml b/docs/code-snippets/office-snippets.yaml index bae8f002db..78aa4c23eb 100644 --- a/docs/code-snippets/office-snippets.yaml +++ b/docs/code-snippets/office-snippets.yaml @@ -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. diff --git a/docs/docs-ref-autogen/office/office/office.requirementsetsupport.yml b/docs/docs-ref-autogen/office/office/office.requirementsetsupport.yml index a19eb2623e..d60d6f5ce7 100644 --- a/docs/docs-ref-autogen/office/office/office.requirementsetsupport.yml +++ b/docs/docs-ref-autogen/office/office/office.requirementsetsupport.yml @@ -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 diff --git a/docs/docs-ref-autogen/office_release/office/office.requirementsetsupport.yml b/docs/docs-ref-autogen/office_release/office/office.requirementsetsupport.yml index a19eb2623e..d60d6f5ce7 100644 --- a/docs/docs-ref-autogen/office_release/office/office.requirementsetsupport.yml +++ b/docs/docs-ref-autogen/office_release/office/office.requirementsetsupport.yml @@ -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 diff --git a/generate-docs/API Coverage Report.csv b/generate-docs/API Coverage Report.csv index e03003b0dc..3b694c0505 100644 --- a/generate-docs/API Coverage Report.csv +++ b/generate-docs/API Coverage Report.csv @@ -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 diff --git a/generate-docs/script-inputs/local-repo-snippets.yaml b/generate-docs/script-inputs/local-repo-snippets.yaml index ca6be0ac8d..fa35ca8476 100644 --- a/generate-docs/script-inputs/local-repo-snippets.yaml +++ b/generate-docs/script-inputs/local-repo-snippets.yaml @@ -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.