Search code examples
javascriptms-officeoffice-jsclickonceoffice-addins

Office Addin load latest version programmatically


I am developing an Office addin, there is a requirement from client that latest version of addin should load on user's system. It will be deployed as Admin Managed addin, but when we upload a new version it is not auto updated. User has to go to Office Add-in screen and press refresh button. Is there some way that I can perform these steps programmatically.

Also if I cannot do the above auto refresh, can I clear Office cache through javascript on my taskpane so that next time it loads latest version? I know that I can clear chache manually, but I want to achieve it programmatically.

If I cannot achieve both of the above tasks, can we deploy Office-js addin as click-once app as we can do with VSTO apps?


Solution

  • can we deploy Office-js addin as click-once app as we can do with VSTO apps?

    No, Office web add-ins (OfficeJS) can't use ClickOnce for deployments. You can read about possible ways of deployments in the Deploy and publish Office Add-ins article.

    can I clear Office cache through javascript on my taskpane so that next time it loads latest version?

    Nope. Instead, you can set up http-properties on the files. Use Cache-control HTTP directives to control who can cache the response, under which conditions, and for how long. See Guide for Caching and HTTP Cache Headers for Static Content for more information.

    So, you may instruct the end point (web browser) for how long to keep old files and when to refresh them. Going that way you may force the browser to update the add-in files.