I am using MS Graph c# SDK to pull the thumbnail links for some docx and pdf files. The issue I was planning to store these links in my db to call them quickly for the front end. However, I noticed anytime a document is saved the link changes. However, the old URL still works and it also includes the latest changes. Is it safe to store the URLs and reuse them or does it not matter as my current experiment is showing:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var thumbnails = await graphClient.Me.Drive.Items["{driveItem-id}"].Thumbnails
.Request()
.GetAsync();
The URLs change to ensure that browser will invalidate their cache and render an updated thumbnail. We generally don't recommend caching the URLs yourself because there may be scenarios that trigger an expiration of the URL, at which point what you have cached will fail to work. However, as long as you handle failures of cache URLs by falling back to getting a new thumbnail URL maybe it'll be ok for your scenario.