OfficeJS - Cache file

85 Views Asked by At

I'm developing a word add-in using the OfficeJS API. I'm using VS Community 2022 (17.8.3) and Office 365 (version 2312). The organization of my add-in is classic and consists of a Home.html page for my taskpane, and a FunctionFile.html page from which the functions are called. I currently have some functions integrated directly into the ribbon and others integrated into my taskpane.

The problem I'm having is that the FunctionFile.js file doesn't update when I modify it and run it again. So there seems to be a cache of my file somewhere but I don't know how to remove it and stop caching it systematically. Usually, it takes a couple of days to update it.

I can see this cached file not updated by inserting a breakpoint and executing the function. It then appears in a "Dynamic" window.

I've already tried checking the "Disable cache" box in DevTools.

I've also tried checking the "Next time you start Office, clear the cache of all previously started Web add-ons" box. I don't know if this has any impact, but the box remains checked when I open Word normally but unchecks automatically when I open Word via VS.

I also systematically clear the Office cache using the method described here: https://learn.microsoft.com/en-us/office/dev/add-ins/testing/clear-cache.

I've run out of solutions and don't know how to solve this problem. I've had this problem in the past, but I solved it by checking the "Disable cache" box (that's not enough today).

Do you have a solution?

2

There are 2 best solutions below

1
J i N On BEST ANSWER

You are correct I aslo facing this issue when I was working on ribbon some time its automatically picked new code of function.js file but some times after restating my project it's picked new code but some times it is not picking new code after restart or clear the Office cache. In my case I am using windows system its picked new code after clearing windows cache or some time need to restart my system.

if you're using windows this you can clear cache using this way

press windows + R

this will open run then type in input %temp% you will go in a folder its path like this

C:\Users\username~1\AppData\Local\Temp

select all the files and delete.

Run %temp% image

now again open run type temp and delete all the file and restart your project. this is works fro me hopefully its works for you.

run temp image

0
Eugene Astafiev On

You can use the HTTP headers for your files to manage how browsers cache the files locally. The Cache-Control HTTP header field holds directives (instructions) — in both requests and responses — that control caching in browsers and shared caches (e.g. Proxies, CDNs).