How to Embed a Shared OneDrive Folder on an Azure Website
Question details
The user needs to provide authenticated website visitors access to an entire shared organizational OneDrive folder hosted on an Azure website.
- Product
- OneDrive / Azure
- Device & OS
- not provided
- Scenario
- Developing or managing an Azure-hosted web application that requires displaying a complete OneDrive folder directory to authenticated users.
- Observed behavior
- While individual OneDrive files can be embedded via iframe, OneDrive does not natively support embedding an entire folder directly into a webpage.
Ensure you have administrative access to your Azure portal, the Microsoft Entra ID (Azure AD) application registrations, and the organizational OneDrive account with appropriate sharing permissions.
Use a Direct Link to the Shared OneDrive Folder
Since native embedding of folders is not supported, providing a direct, authenticated link to the folder is the simplest and most reliable workaround.
Navigate to the organizational OneDrive online portal, locate the target folder, click the 'Share' icon, and configure the link settings to allow access for your authenticated users.
Click 'Copy Link' to generate the URL for the folder.
Insert a hyperlink or a styled button in your website's HTML code (e.g., <a href="[URL]">Open Shared Folder</a>) directing users to the OneDrive folder.
Build a Custom Integration via Microsoft Graph
For a seamless user experience that keeps users on your site, developers can use the Microsoft Graph API to programmatically list and display the folder contents.
Need a Lightweight Office Alternative? Try WPS Office
While integrating complex Microsoft APIs like OneDrive and Azure requires development effort, choosing your daily productivity software should be simple. WPS Office is a highly compatible, free alternative to Microsoft Office that meets all your document editing needs.
- 1. Download WPS Office: Visit the official WPS website and download the installation package for your operating system.
- 2. Install the Application: Run the installer and follow the on-screen prompts to set up WPS Office on your device.
- 3. Open Your Documents: Launch WPS Office and instantly open your existing .docx, .xlsx, and .pptx files with full formatting support.

Frequently Asked Questions
Can I embed a single OneDrive file instead of an entire folder?
Yes, OneDrive natively supports embedding individual files such as Word documents, Excel spreadsheets, and PowerPoint presentations. You can generate an embed code directly from the OneDrive web interface by right-clicking the file and selecting 'Embed'.
Why doesn't OneDrive allow folder embedding directly via iframe?
Microsoft currently restricts folder embedding primarily for security, authentication, and cross-site scripting (XSS) prevention reasons. Browsing a directory requires active session tokens that do not seamlessly pass through standard iframe embeds.
Is it safe to use Microsoft Graph client secrets in my website's JavaScript?
No, it is highly insecure to expose client secrets in client-side code (like JavaScript running in the browser). Malicious users can easily extract these secrets and gain unauthorized access to your organization's data. Authentication should always occur on a secure backend server.




