Office Add-ins deployment
32 TopicsFeature Request: Add error/rejection support to Office.onReady() for network/dependency failures
Description Currently, when Office.js loads but one of its dependent resources (such as office_strings.js) fails to load due to network issues or blocking, the Office.onReady() promise never resolves or rejects. This leaves developers without a reliable way to detect missing dependencies. Instead of relying on timeouts or log messages, it would be very helpful if Office.onReady() provided an error callback or rejection in these scenarios. Why this matters: Helps developers handle production failures gracefully. Avoids arbitrary timeouts/workarounds to detect missing dependencies. Provides parity with modern async practices where promises resolve or reject deterministically. Enables better telemetry/analytics by explicitly knowing why initialization failed. Suggested Approach: If a required dependency fails to load, Office.onReady() should reject with an error describing the missing dependency. Alternatively, provide an event/callback (e.g., Office.onError) that developers can subscribe to. Example: Office.onReady() .then(info => { console.log("Office.js initialized:", info); }) .catch(err => { console.error("Office.js failed to initialize:", err); // custom fallback handling }); Impact: This would improve developer experience significantly and make add-ins more resilient in real-world network environments.Add-in Manifest: allow wildcards for app domains
Currently all trusted app domains must be listed fully qualified in the manifest, e.g. <AppDomain>https://customer1.acme-eu.com</AppDomain> <AppDomain>https://customer2.acme-eu.com</AppDomain> <AppDomain>https://customer3.acme-us.com</AppDomain> <AppDomain>https://customer4.acme-us.com</AppDomain> Our company has several root domains for their customer tenants. In the example above acme-eu.com and acme-us.com. But as these customer tenant URLs (e.g. https://customer2.acme-eu.com) are sensitive data we can not put them in our delivered add-in manifest because all other customers would have the chance to see them. Currently our customers need to use the O365CentralizedAddInDeployment PowerShell command to configure additional domains before using our add-in which is extremely error prone and sometimes just not working. Many hours of support needs to be invested to get the configuration fixed. For example after every change in the configuration all users needs to manually clear their add-in cache in Excel. Having wildcards in the manifest would enormously help us and our customers: <AppDomain>https://*.acme-eu.com</AppDomain> <AppDomain>https://*.acme-us.com</AppDomain> During add-in submission Microsoft can validate that the used domains are trustful.750Views21likes5CommentsLimitation with Static AppDomain Entries in Office Add-in Manifest
As outlined in the [Microsoft documentation](https://learn.microsoft.com/en-us/javascript/api/manifest/appdomain), trusted domains must be explicitly declared in the Office Add-in manifest using the <AppDomain> element. A trusted domain allows: - Pages, routes, or other resources in that domain to be opened directly in the root task pane on desktop Office platforms (note: this does not apply to Office on the web or dialog APIs). - Pages in that domain to make Office.js API calls from IFrames within the add-in. We are currently developing a first-party native Excel Add-in as part of a strategic partnership. However, our architecture requires support for customer-specific subdomains, such as: ``` <AppDomain>https://customer1.company.com</AppDomain> <AppDomain>https://customer2.company.com</AppDomain> <AppDomain>https://customer3.company.com</AppDomain> <AppDomain>https://customer4.company.com</AppDomain> ``` This list is dynamically growing, making it infeasible to maintain a static list of subdomains in the manifest. Each manifest update would require re-submission through AppSource, creating significant operational overhead and slowing down delivery. Because of this limitation, we’re forced to distribute customer-specific manifests and rely on M365 tenant admins to install the add-in manually—introducing friction and reducing discoverability for users. We propose enabling wildcard support for <AppDomain> entries in the manifest, e.g.: ``` <AppDomain>https://*.company.com</AppDomain> ``` This would allow all subdomains under company.com to be trusted without requiring individual enumeration, simplifying deployment and scaling while preserving security. This limitation has been highlighted and highly upvoted by the developer community in the following feature requests: - https://techcommunity.microsoft.com/idea/microsoft365developerplatform/add-in-manifest-allow-wildcards-for-app-domains/4162573 - https://techcommunity.microsoft.com/idea/microsoft365developerplatform/support-wildcards-for-appdomains-in-office-add-in-manifests-to-support-sub-domai/2312326Add support to remove unused master slides via the PowerPoint API
VBA Macros allow us to remove unused master slides, however similar functionality is currently not available in the PowerPoint API. Reusing slides from multiple templates can lead to huge size files since most of the time people don't select "Use Destination Theme" as paste option. Having access to the master slides info could allow web-based add-ins to provide users the option to remove unused master slides, which is a more easy way than old-school VBA macrosProgrammatically set the cursor (caret) to a specific location in an e-mail
Describe your scenario We are writing an addin for One Outlook where we place a signature text in the body of an e-mail. What is the problem to solve? The signature text we are placing is added correctly, but the cursor (caret) is placed at the bottom of the inserted text. We would like to control where the cursor (caret) is placed after we inserted the text. We have tried the following ideas: Using setSelectedDataAsync to dynamically insert content immediately after the marker. Manipulating the HTML with getAsync and setAsync to simulate the desired cursor position. Adding selectable elements, such as a span with a zero-width space, to force the cursor to position itself at the marker. Using prependAsync to insert content at the beginning of the body as an alternative to controlling the cursor. Implementing JavaScript methods like this: function setCaret() { var el = document.getElementById("editable"); var range = document.createRange(); var sel = window.getSelection(); range.setStart(el.childNodes[2], 5); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); } Which APIs or add-in features? We are using Office.JS, see https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/insert-data-in-the-body#insert-data-at-the-current-cursor-position We have asked this question https://github.com/OfficeDev/office-js-docs-pr/issues/5188 , but this feature isn't available. Can this feature be added? There is a more or less similar question here.Automated NLP conversational agent production, with Office, without writing code
I have developed a solution which allows people to create Natural Language conversational agents, using MS Office and VBA, without writing any line of code. The method starts with MS Word. The integrated VBA code extract patterns from Docx documents. MS Excel get back these patterns and through its VBA capabilities, produce after few clicks (fully automated process) a Graphed Conversational Agent that I can query in Natural Language to find the right answer : from MS word documents to MS Excel queries in few clicks. I plan also to automate another use case which is Text Analytics document comparizon.Implement Office.context.mailbox.item.getAsFileAsync for draft messages
We have a requirement in an Office.js add-in to do the following: Automatically send a message Save the sent message The functionality was previously implemented using EWS and Office.context.mailbox.getCallbackTokenAsync. However, both are being phased out. Office.auth.getAccessToken is supposed to replace Office.context.mailbox.getCallbackTokenAsync, but we did not manage to get it to work in my add-in. To send the mail, Office.context.mailbox.item.sendAsync is now available, but it currently does not allow to execute code after sending. So we want to collect the draft before sending and process it in the back-end of our web app. We are hindered here by the fact that Office.context.mailbox.item.getAsFileAsync cannot be used on a draft. The function is currently not available for a draft message, we get the error message `Office.context.mailbox.item.getAsFileAsync is not a function` when trying to use it. The same works fine for messages in other Outlook folders like Inbox or Sent Items. To assemble eml-like text for the draft message so that we can save it in the back end of our add-in requires quite a lot of code. Also, img nodes reference external content, e.g., they have a src like `src="https://attachments.office.net/owa/.../service.svc/s/GetAttachmentThumbnail?id=` with id being a base64 string, where an eml should have `src="cid:` with cid referencing to a short id of a mime part in the same eml. There is no straightforward way to resolve all images when building an eml client-side.How to get current page number and the total page count of a document using Word Add-in office.js
I would like to inquire if there is a method or feature available in Office.js for programmatically obtaining the current page number and the total page count of a document. Specifically, I am interested in accessing this information within the Microsoft Word application. Additionally, if such a feature is not currently available, do you have any plans or information regarding the potential release of this feature in the future? It's worth noting that our organization does not use OneDrive for any operations. Here are the details of my environment: Platform: PC desktop Host Application: Microsoft Word Office Version: Microsoft Word for Microsoft 365 MSO (Version 2304 Build 16.0.16327.20200) 64-bit Operating System: Windows 10 Pro Thank you for your assistance.Enhanced Document Control/Protection APIs in Office.js for Word Add-ins
We are developing a Word add-in using Office.js and JavaScript APIs. Our use case requires advanced document control features, which are currently challenging to achieve within the existing Office.js framework. Here’s our feature request: Proposed Functionality: Based on the defined custom properties on a document via add-ins, provide APIs/commands/hooks to disable or override Word's default 'Save,' 'Save As,' and 'Share' options to prevent users from saving or sharing the document locally. Introduce additional APIs for implementing custom protection mechanisms within the add-in. Current Challenges: Achieving this functionality appears possible through VSTO add-ins, but they are not compatible with Office.js solutions. VSTO/.NET commands require complex workarounds, such as creating a separate .NET server to communicate with Office.js, which adds development complexity and affects efficiency. Request: We would greatly appreciate the introduction of built-in, efficient APIs in Office.js to handle document protection and control scenarios seamlessly without relying on external frameworks or services. This would significantly enhance the capability of modern web-based add-ins and improve the development experience for Word add-in developers.