An Office service that supports add-ins to interact with objects in Office client applications.
Hi @Rajat Bharadwaj
Thank you for posting your question in the Microsoft Q&A forum.
Word Add‑ins built with Office.js do not currently provide an API that allows an add‑in to programmatically open or switch to another Word document in the current Word client, either in Word Desktop or Word for the web. An add‑in is limited to interacting with the document in which it is currently running.
However, you can still meet collaboration requirements by opening the document through its SharePoint or OneDrive URL, for example: https://tenant.sharepoint.com/sites/siteName/Shared%20Documents/file.docx
-Word for the Web: The document opens in the browser and supports real‑time co‑authoring.
-Word Desktop: When opened from SharePoint or OneDrive, the document supports real‑time co‑authoring as well.
From a Word Add-in, you can launch the document link using:
Office.context.ui.openBrowserWindow(documentUrl);
This opens the SharePoint document in the browser, from which users can choose to continue editing in Word for the web or open it in Word Desktop. Both options preserve collaboration because the file remains stored in SharePoint or OneDrive.
If the add‑in downloads the file and opens it locally, Word will treat it as a local document and co‑authoring will not be available. To enable collaboration, the document should be opened directly from its SharePoint or OneDrive location.
Reference: Office.js API — Open OneDrive Files in Current Word/PPT Instance | Microsoft Community Hub.
I hope this information is helpful.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.