diff --git a/src/helpers/utilities.ts b/src/helpers/utilities.ts index 69230b9..eca8f7a 100644 --- a/src/helpers/utilities.ts +++ b/src/helpers/utilities.ts @@ -45,7 +45,11 @@ function getHostInfo(): { // when queried from within an add-in. // If the platform already exposes that info, then just return it // (but only after massaging it to fit the return types expected by this function) - const context: IContext = ((window as any).Office && (window as any).Office.context) || useHostInfoFallbackLogic(); + const Office = (window as any).Office as { context: IContext }; + const isHostExposedNatively = Office && Office.context && Office.context.host; + const context: IContext = isHostExposedNatively + ? Office.context + : useHostInfoFallbackLogic(); return { host: convertHostValue(context.host), platform: convertPlatformValue(context.platform)