office-js

Change value of a table in content control

試著忘記壹切 提交于 2019-12-06 08:31:00
I created a Word add-in and I insert a table in Word 2016 (version 16.0.7341.2029) using the Word API 1.3 like this: var value = [[3,4],[5,6]]; Word.run(function (ctx) { var table = ctx.document.body.insertTable(value.length, value[0].length, Word.InsertLocation.end, value); var myContentControl = table.insertContentControl(); myContentControl.tag = 'MyTable1'; myContentControl.title = 'This is a table'; return ctx.sync() .then(function () { console.log('Table created'); }).catch(function (err) { console.log(err); }); }); I see the table in a content control with the proper values. When I

Insert table inside content control with Office.js

陌路散爱 提交于 2019-12-06 08:12:01
i'm trying to insert a table inside the content control. Here is my code: function insertTable() { Word.run(function (context) { var range = context.document.getSelection(); var cc = range.insertContentControl(); cc.title = "My Table"; var values = [["Apple", "red", "round"], ["Banana", "yellow", "long"], ["Pear", "green", "oblong"]]; context.load(cc); return context.sync().then(function () { var table = cc.insertTable(3, 3, 'Start', values); }) // Synchronize the document state by executing the queued commands, // and return a promise to indicate task completion. .then(context.sync); })

Office Add-in development: Insert table in Word 2016

夙愿已清 提交于 2019-12-06 08:05:53
I am trying to insert a table using Office.js inside the body of a document but to no avail. I have used the following code: function insertSampleTable() { showNotification("Insert Table", "Inserting table...") Word.run(function (context) { // Create a proxy object for the document body. var body = context.document.body; body.insertTable(2, 2, Word.InsertLocation.end, ["a"]); // Synchronize the document state by executing the queued commands, and return a promise to indicate task completion. return context.sync(); }) .catch(errorHandler); } But upon clicking the button, it gives me the error

Outlook API to forward email as attachment

独自空忆成欢 提交于 2019-12-06 07:10:56
I'm currently developing an Outlook Add-in and trying to add a feature to forward an email as an attachment. Can anyone please advice what the simplest way to accomplish it? I cannot find a single API to do it in Outlook Mail REST API reference . Is there any easier way instead of using the 3 different APIs? CreateForwardDraft UpdateMessages SendDraftMessages Outlook Add-ins Team - MSFT There is an API - addItemAttachmentAsync which can add an email as an attachment. Currently, the forward functionality you requested is not a part of the product. However, we track Outlook add-in feature

prevent task pane from closing during saving (async)

落花浮王杯 提交于 2019-12-06 06:43:51
问题 We use the OfficeJs REST API for add-in development. To use this API, an accesstoken is needed, which we request by invoking Office.mailbox.getCallbackTokenAsync({ isRest: true }) during startup of our add-in. This does not fail for any code triggered by the onSend function: It seems OfficeJs saves the mail item before onSend code is triggered. However, this request apparently does fail when the mail item is not yet saved - which is the case for any new draft when it is just created - and

Insert comment in Word using office.js

有些话、适合烂在心里 提交于 2019-12-06 06:02:31
I am trying to make a Word add-in in office.js that inserts comments in the document. It seems to me the only way to achieve this is to use OOXML. I can insert the comment but my problem is that when I do so a paragraph break is inserted as well as can be seen from this image. A far as I can see it boils down to that if I am only inserting some text the content of the body looks like the following which works fine <w:p> <w:r> <w:t>Some text</w:t> </w:r> </w:p> But if I am inserting a reference to a comment it results in a paragraph end right after whatever I am insering. In that case the

Expanding singleValueExtendedProperty not working when retrieving Event details

笑着哭i 提交于 2019-12-06 05:52:58
I am trying to retrieve custom property value for an event using Microsoft Graph. The custom property was created by an Outlook Office.js Add-ing Here is request /v1.0/me/events/{id}?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name myCusProp') This returns a successful response from Graph but it does not return the singleValueExtendedProperty . The Outlook add-in, however, is still able to retrieve the property value from the same Event. { "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{id}')/events/$entity", "@odata

How to tell when to use EWS vs rest API in Outlook Add-in

对着背影说爱祢 提交于 2019-12-06 04:52:12
Is it possible to tell either in the XML file or through OfficeJs if the add-in can use the REST API or if it needs to use the older EWS API? We have an Outlook add-in that needs to support OWA/O365 and Outlook 2016 with a stand alone exchange server. We are wondering if it is possible through the manifest XML file or through OfficeJs to detect the configuration of users account so we can properly access their content with the correct API. The only alternative I can see is to provide two separate add-ins for this, but I assume MS has a solution to this issue. There isn't a specific API for

JavaScript API does not work for Excel 2013?

核能气质少年 提交于 2019-12-06 04:45:24
问题 I just got a change recommendation report for one add-in I submitted. It says Your add-in is not working in the Excel 2013 client on Windows 7 with Internet Explorer 11. I have always been testing my add-in in Excel 2016 and Excel Online . So I just installed Excel 2013 (version 15.0.4841.1000 , which includes SP1), indeed the add-in does not work. But it seems that few things work... For example, the following example function writes haha in Cell A1 under Excel Online , whereas, it does not

Cannot find name 'Office'

天涯浪子 提交于 2019-12-06 04:20:34
I am using Angular 4 with Office.js. The project is created by Angular CLI. The code is simple: // declare const Office: any; // With the line above, the app runs perfect Office.initialize = function () { platformBrowserDynamic().bootstrapModule(AppModule); }; I got the error Cannot find name 'Office'. I already did npm install --save-dev @types/office-js My tsconfig.json file: { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators":