Forum Discussion
hoyty76
Jan 18, 2019Steel Contributor
Making OneDrive links last longer or be renewable?
At my school teachers have used onedrive links to build QR codes that are then used in books or on posters. The problem is now that OneDrive / SharePoint link have a maximum lifetime of 730 days thos...
- Jan 20, 2019
I believe the 730 limit only applies if you have configured link expiration. You can simply turn it off (set to 0).
Tanveer Yousuf
Jan 20, 2019Copper Contributor
It is true that the maximum number of days a link can be valid for is 730 days. It is just the way it is at this moment.
However, there is a potential solution which would require some development.
- Create a link programmatically using the OneDrive File Sharing API.
- Create a record in your custom application with a unique ID that points to this URL along with creation date (or expiration date).
- Create an HTTP endpoint say https://yoursite.com/url/<ID>. This endpoint simply redirects the user to the actual OneDrive file sharing URL. The HTTP endpoint will have some kind of logic which would simply create a fresh OneDrive link for a file when requested if the actual OneDrive link is about to or has already expired. This little logic would be executed before redirection.
Now, instead of this custom application, you could instead use a URL shortener service like Google URL Shortener or Tiny URL. However, the problem is that their own expiration policy would still be out of your control. Google URL Shortener's URLs don't expire as per their current policy. For reference, here is the Google URL Shortener API documentation https://developers.google.com/url-shortener/v1/getting_started