How to Open OneDrive from an Outlook Desktop Add-in Using Office.js
Question details
Developers want to know how to open or navigate to OneDrive directly from an Outlook Desktop add-in using the Office.js API.

- Product
- Outlook Add-in (Office.js)
- Device & OS
- not provided
- Scenario
- Creating an Outlook desktop add-in and attempting to switch the navigation interface to OneDrive or open OneDrive modules.
- Observed behavior
- Office.js does not provide an API for switching Outlook desktop modules or opening OneDrive directly inside the Outlook navigation rail.
Ensure you have the latest version of the Office JavaScript API (Office.js) and active credentials if you plan to use the Microsoft Graph API as a workaround.
Use displayDialogAsync to Open OneDrive in a Dialog or Browser
Since direct navigation within the Outlook client is unsupported, use the Dialog API to open the OneDrive web interface in a separate window.
The Office JavaScript API restricts add-ins from changing the main Outlook desktop navigation modules. However, you can utilize the Dialog API to securely authenticate and display external web content, such as OneDrive.
In your add-in's JavaScript code, prepare the URL for the OneDrive web interface or your custom OneDrive file picker.
Execute Office.context.ui.displayDialogAsync('https://onedrive.live.com', {height: 50, width: 50}, function (asyncResult) { ... }); to trigger the popup.
Set up a callback function to handle messages or events from the dialog box, allowing your add-in to know when the user has finished interacting with OneDrive.

Access OneDrive Files Programmatically via Microsoft Graph
If you need to interact with OneDrive files rather than showing the UI, use the Microsoft Graph API.
Submit a Feature Request to the Office.js Team
Report the API limitation to Microsoft to advocate for future support of module switching.
Looking for a Flexible and Developer-Friendly Office Suite?
If you are encountering platform limitations with Microsoft Office add-ins, consider exploring WPS Office. It provides a lightweight, highly compatible alternative with excellent support for document automation and existing Microsoft file formats.
- 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
- 2. Install the Software: Run the installer and follow the quick setup instructions to integrate WPS onto your desktop.
- 3. Open Your Documents: Launch WPS Office and instantly open your existing Microsoft Word, Excel, and PowerPoint files without formatting loss.

Frequently Asked Questions
Can I switch Outlook desktop modules directly using Office.js?
No, currently the Office JavaScript API (Office.js) does not provide any methods to switch between Outlook desktop modules (like moving from Mail to Calendar or OneDrive) directly within the navigation interface.
Does displayDialogAsync open OneDrive inside the Outlook window?
The displayDialogAsync method opens a separate dialog box or launches the user's default web browser. It does not embed the OneDrive interface natively within the main Outlook client window.
Where can I request new API features for Outlook add-ins?
You can submit feature requests, report bugs, or discuss API limitations directly with the development team on the official GitHub repository at github.com/OfficeDev/office-js/issues.




