office-js

Why Outlook's RoamingSettings object initialized with old values after page re-load/ redirect?

梦想的初衷 提交于 2019-11-28 10:28:10
Precondition: Simple Outlook add-in with one (reload case) or two HTML pages (redirect case). Office.initialize called before any objects access Use RoamingSettings object as per documentation: How to save settings in the user's mailbox for Outlook add-ins as roaming settings Coding: // The Office initialize function must be run each time a new page is loaded Office.initialize = function (reason) { $(document).ready(function () { app.initialize(); var settings = Office.context.roamingSettings; // Get the current value of the 'myKey' setting // let's assume it was set and stored with value

Get slide index or visibility state of PowerPoint content addin (Office.js)

[亡魂溺海] 提交于 2019-11-28 10:05:20
问题 I'm writing a PowerPoint content addin using Office.js API. I need a way for each instance of that addin to determine the index of the containing slide, or, if this is impossible, the visibility state of the addin (i.e. whether the containing slide is currently visible on screen). The documentation suggests no API specifically intended for this purpose, so I've been using the following method: Upon addin initialization (inside Document.initialize callback), request currently selected slide

How to pass model to Office 365 Dialog from Word 2016?

梦想的初衷 提交于 2019-11-28 08:38:50
问题 I was playing with Office 365 add-in for MS word. I have a dialog to manipulate selected word image. I need to pass that image (maybe a Base64 value of that) to my dialog so that I can play with the image before replacing back to the word(same location). I am using below code to show the popup: Office.context.ui.displayDialogAsync("https://" + location.host + "/Views/ImageManager.html", { width: 64, height: 55, requireHTTPS: true }, function (asyncResult) { dialog = asyncResult.value; dialog

Office.js web WORD add-in: window.open() method is not working with “about:blank” URL

£可爱£侵袭症+ 提交于 2019-11-28 06:51:10
问题 Summary : window.Open('') or window.Open('about:blank') works with JavaScript in a normal html file as can be tested here. But it does not seem to work in an Office.js add-in. Details : On my Windows 10 desktop with VS2017 I created this Office.js WORD add-in project that works perfectly with my Microsoft Office Home and Student 2016 edition. In the same project, I then created a new button btnTest in the home.js file. When I click btnTest it successfully calls the following MyTest method and

How to detect if Office 365 addin is already active from a VSTO Outlook addin or vice-versa?

瘦欲@ 提交于 2019-11-28 06:06:08
问题 I am no programmer in this field. We had an addin built on VSTO framework, which works for all Windows Outlook applications. Recently, we built O365 addin and it solves our problem of distribution to Mac. However, the existing Windows Outlook users see two different addins. Is there a way to detect if Outlook windows addin already installed through O365 addin or vice-versa? 回答1: Unfortunately, there is no functionality to detect COM/VSTO add-on installation or enumerate installed add-ons from

Best way to write loops with promises (ctx.sync) in JavaScript API for Office

a 夏天 提交于 2019-11-28 05:58:53
问题 There are many threads that discuss about guaranteeing execution order of promises in loops. I would like to know what is the best practice in JavaScript API for Office Add-ins. Most of the time, the promise in question is ctx.sync() . Here is a snippet to print the address of a list of Excel ranges one by one. The test shows that it respects well the order of Excel ranges. But the question is whether and how to guarantee the execution order? function loadAll () { var ranges = ["A:A", "B:B",

Get custom property set in Outlook Add-In via Microsoft Graph

六月ゝ 毕业季﹏ 提交于 2019-11-28 02:12:29
Let's say I have in my Outlook Add-In (using Office.js) following code running on a compose form of an appointment: const item = Office.context.mailbox.item; item.loadCustomPropertiesAsync((result) => { const props = result.value; const testProp = props.get("my_prop"); console.log("CUSTOM_PROP", testProp); props.set("my_prop", "test_value"); props.saveAsync((saveResult) => console.log("SAVE_CUSTOM_PROP", saveResult)); }); I see, that it actually is saved on the event. And now a bunch of questions regarding those custom properties: But are those somehow related to extended properties? Are those

Office.js dialog makes Outlook hang after 5 minutes

最后都变了- 提交于 2019-11-28 02:11:18
问题 I'm running a sample Outlook add-in dialog application. It just displays a dialog with 2 buttons, does not have any logic nor it makes any calls to REST service. If more than 5 minutes elapse before closing the dialog, Outlook's compose frame becomes unresponsive and the user is forced to refresh the entire page Is this behavior expected? Is the timeout configurable? Any recommendations how to handle such situation and provide the best user experience? 回答1: From your screenshot and the code

Open an html page in a default browser from an add-in

大憨熊 提交于 2019-11-28 01:45:43
问题 I would like to insert a hyperlink to the task pane of my add-in, and I want this link to open support.html page in a default browser. <a href="https://example.com/support.html" target="_blank">Support</a> However, the above code opens support.html page inside the task pane. Users may not know how to go back to the main page of the add-in. Does anyone know how to open the page in a default browser of users? (By the way, is it recommended to launch something outside the add-in? If not, what's

Office.js nullifies browser history functions breaking history usage

淺唱寂寞╮ 提交于 2019-11-27 22:52:07
The official version of office.js available here: https://appsforoffice.microsoft.com/lib/1/hosted/office.js It contains the following lines in code: window.history.replaceState = null; window.history.pushState = null; This breaks some of the history functionality in my Excel Add-ins (I'm using react and react-router ) Why is office.js nullifying those history functions? I cannot find any explanation in the documentation. The browser control used in Excel does not support History API, if replaceState and pushState were not nulled out they would be available to react but always throw an