Forum Discussion
Caching of Images on SharePoint Online Pages
- Mar 03, 2023
Append a unique query string parameter to the image URL: You can append a unique query string parameter to the image URL each time it's updated, which will force the browser to reload the image. For example, you can add "?v=1" to the end of the image URL, and then increment the value of "v" each time the image is updated. This can be done in Power Automate by using the "Compose" action to append the query string parameter to the file URL.
Change the file name of the image: If appending a query string parameter doesn't work, you can try changing the file name of the image each time it's updated. For example, you can add a timestamp or date to the file name to ensure that it's unique. This will force the browser to load the new version of the image.
Use a content delivery network (CDN): You can use a CDN, such as Azure CDN or Amazon CloudFront, to serve the image file. CDNs cache content on servers located closer to the end user, which can improve performance and reduce the likelihood of browser caching issues.
Disable caching for the image file: You can configure your SharePoint site to disable caching for the image file. To do this, go to the site settings, select "Site collection features", and then activate the "Output Cache" feature. This will disable caching for the entire site. Alternatively, you can use the "Cache-Control" HTTP header to control caching for individual files.
Append a unique query string parameter to the image URL: You can append a unique query string parameter to the image URL each time it's updated, which will force the browser to reload the image. For example, you can add "?v=1" to the end of the image URL, and then increment the value of "v" each time the image is updated. This can be done in Power Automate by using the "Compose" action to append the query string parameter to the file URL.
Change the file name of the image: If appending a query string parameter doesn't work, you can try changing the file name of the image each time it's updated. For example, you can add a timestamp or date to the file name to ensure that it's unique. This will force the browser to load the new version of the image.
Use a content delivery network (CDN): You can use a CDN, such as Azure CDN or Amazon CloudFront, to serve the image file. CDNs cache content on servers located closer to the end user, which can improve performance and reduce the likelihood of browser caching issues.
Disable caching for the image file: You can configure your SharePoint site to disable caching for the image file. To do this, go to the site settings, select "Site collection features", and then activate the "Output Cache" feature. This will disable caching for the entire site. Alternatively, you can use the "Cache-Control" HTTP header to control caching for individual files.
- owertzMar 22, 2023Copper Contributor
Firstly, thank you for the quick response! It's very much appreciated. I'm replying with my update on this, as I've continued to work on trying to implement one of your suggestions:
- My colleagues and I aren't extremely familiar Power Automate, and I'm new to web development all together. We weren't able to get this flow to work properly that generated a URL that actually worked.
- This would be the "obvious" solution to the issue. However, we weren't able to create a way to update the image with the new file name on our SharePoint home page without manually updating it every day, which won't work for us.
- This solution seemed to yield the most results. We had no issues creating a Private Azure CDN and serving the image file on that CDN. However, it doesn't consistently update. Some days the caching gets refreshed, other days it does not. I've reached out to my Microsoft rep for assistance with this one, as this is not expected behavior.
- This option doesn't exist in SharePoint for Microsoft 365. Looks all throughout the site and page settings, but wasn't able to find that specific setting.
Either way, I think the CDN route will be the solution to the issue once I get an update from MS on the issue. I'll update when I have a compete solution.
Thanks again!