How to Create OneDrive Download Links That Preserve File Names
Question details
The user needs to generate OneDrive download links that maintain the original file paths and names, allowing an HLS video player to correctly locate M3U8 playlists and accompanying TS media segments.

- Product
- OneDrive
- Device & OS
- not provided
- Scenario
- Hosting and delivering streaming media files (HLS/M3U8) via cloud storage.
- Observed behavior
- OneDrive generates download URLs utilizing unique file IDs instead of standard Amazon S3-style folder paths, which breaks the relative path dependencies required by HLS players to locate media segments.
Keep in mind that OneDrive is primarily designed for document collaboration and storage rather than functioning as a dedicated Content Delivery Network (CDN) for streaming media playback.
Use the SourceUrl Parameter for Path-Based Links
Create a force-download URL that explicitly references the file's exact hierarchical path instead of its unique ID.
While OneDrive does not support custom path routing identically to Amazon S3 natively, you can bypass the unique ID system by utilizing the SourceUrl parameter. This method forces the server to locate the file via its folder path.
Log in to OneDrive for the Web. Note your tenant name, user account name, and the exact path of the target file.
Format your URL as follows: https://<tenantname>-my.sharepoint.com/personal/<useraccount>/_layouts/15/download.aspx?SourceUrl=<filepathURL>
Paste the constructed URL into an incognito browser window to verify that it successfully triggers the download based on the file path.

Generate a Direct Download URL Using the Unique ID
Use the file's unique identifier to create a direct download link if maintaining the folder path is not strictly necessary for your application.
Migrate Media to a Dedicated CDN Storage
Move HLS streaming files to a dedicated object storage service to guarantee proper relative path routing for media players.
Looking for a Lightweight Microsoft Office Alternative?
If you frequently manage complex documents and are exploring alternatives to the Microsoft 365 ecosystem, WPS Office provides a free, fast, and feature-rich solution for all your daily productivity needs.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button.
- 2. Install the Software: Run the installer file and follow the on-screen prompts to set up WPS Office on your device.
- 3. Sign In and Sync: Log in to enable cloud syncing and start opening your Microsoft Office documents seamlessly.

Frequently Asked Questions
Why doesn't my HLS player work with standard OneDrive sharing links?
OneDrive generates sharing links using unique alphanumeric file IDs rather than absolute folder paths. HLS players require standard directory structures to dynamically locate sequential TS media segments relative to the original M3U8 playlist file.
Can I use OneDrive as a CDN for public video hosting?
While possible for small-scale direct downloads, it is not recommended. OneDrive lacks the robust delivery infrastructure, bandwidth allocation, and path-routing capabilities of a dedicated Content Delivery Network, which can lead to rate limiting and broken playback.
What is the purpose of the SourceUrl parameter in SharePoint links?
The SourceUrl parameter instructs the SharePoint or OneDrive server to locate and trigger the download of a file based on its specific directory location (e.g., /Documents/Media/video.mp4) rather than relying on a randomly generated sharing identifier.




