From 49f4ca02656467ebc02de969dc3a00af86ba243f Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Mon, 16 Dec 2024 14:09:52 -0800 Subject: [PATCH] [Word] (insert external doc) Check for platform-specific reqt. set (#955) --- .../50-document/insert-external-document.yaml | 5 +++++ snippet-extractor-output/snippets.yaml | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/samples/word/50-document/insert-external-document.yaml b/samples/word/50-document/insert-external-document.yaml index e3dda038..b9025871 100644 --- a/samples/word/50-document/insert-external-document.yaml +++ b/samples/word/50-document/insert-external-document.yaml @@ -20,6 +20,11 @@ script: const externalDoc: Word.DocumentCreated = context.application.createDocument(externalDocument); await context.sync(); + if (!Office.context.requirements.isSetSupported("WordApiHiddenDocument", "1.3")) { + console.warn("The WordApiHiddenDocument 1.3 requirement set isn't supported on this client so can't proceed. Try this action on a platform that supports this requirement set."); + return; + } + const externalDocBody: Word.Body = externalDoc.body; externalDocBody.load("text"); await context.sync(); diff --git a/snippet-extractor-output/snippets.yaml b/snippet-extractor-output/snippets.yaml index cb46ec1d..7a0f3853 100644 --- a/snippet-extractor-output/snippets.yaml +++ b/snippet-extractor-output/snippets.yaml @@ -15926,6 +15926,11 @@ const externalDoc: Word.DocumentCreated = context.application.createDocument(externalDocument); await context.sync(); + if (!Office.context.requirements.isSetSupported("WordApiHiddenDocument", "1.3")) { + console.warn("The WordApiHiddenDocument 1.3 requirement set isn't supported on this client so can't proceed. Try this action on a platform that supports this requirement set."); + return; + } + const externalDocBody: Word.Body = externalDoc.body; externalDocBody.load("text"); await context.sync(); @@ -15950,6 +15955,11 @@ const externalDoc: Word.DocumentCreated = context.application.createDocument(externalDocument); await context.sync(); + if (!Office.context.requirements.isSetSupported("WordApiHiddenDocument", "1.3")) { + console.warn("The WordApiHiddenDocument 1.3 requirement set isn't supported on this client so can't proceed. Try this action on a platform that supports this requirement set."); + return; + } + const externalDocBody: Word.Body = externalDoc.body; externalDocBody.load("text"); await context.sync(); @@ -20430,6 +20440,11 @@ const externalDoc: Word.DocumentCreated = context.application.createDocument(externalDocument); await context.sync(); + if (!Office.context.requirements.isSetSupported("WordApiHiddenDocument", "1.3")) { + console.warn("The WordApiHiddenDocument 1.3 requirement set isn't supported on this client so can't proceed. Try this action on a platform that supports this requirement set."); + return; + } + const externalDocBody: Word.Body = externalDoc.body; externalDocBody.load("text"); await context.sync();