0

I am working to migrate an Excel Add-in from the old Custom Functions runtime to the new Shared Runtime. We have noticed some of our users don't receive the updated manifest as quickly as others. Therefore, there will be a cross-over period where some of our users have the Shared Runtime manifest and others use the old Custom Functions Runtime manifest. We need some way to detect who's actually running the Shared Runtime, and who's not.

We've found checking isSetSupported('SharedRuntime') returns true, even if the shared runtime is not set in the manifest (particularly on Mac/Online).

Is there a way in the OfficeJS API to determine if the Shared Runtime is active and being used?

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

2 Answers2

0

The isSetSupported('SharedRuntime') method just tells you if the Office version supports shared runtime in principle. It doesn't tell you if the add-in is configured to use a shared runtime.

If a shared runtime is being used, then global variables are shared between the custom function and whatever other add-in feature, such as a task pane, is using the same runtime. I think you can use this to test if a shared runtime is being used. Have the other feature set a global variable on startup (say, in the Office.onReady or Office.initialize method). Then have code in the custom function check if the variable is defined and has the value the other feature set.

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32
  • 2
    After following your advice, I've also found that the global `Office` does not exist in the legacy Custom Functions runtime (for Windows, at least). (`OfficeRuntime` is used instead.) – BardOfBronze Sep 06 '22 at 13:07
  • I was thinking about checking variables, but decided to wait for any insight or hidden ability to check whether a shared runtime is used or not. But it seems I was on the right avenue! – Eugene Astafiev Sep 06 '22 at 13:09
-2

https://learn.microsoft.com/ko-kr/office/dev/add-ins/develop/configure-your-add-in-to-use-a-shared-runtime

you can use [onVisibilityModeChanged] event for checking shareruntime

enter image description here