Questions tagged [office-js]

OfficeJS is the new JavaScript extensibility model for Microsoft Office client applications. You can extend Office applications that run on Windows, web, iOS, and the Mac. This model is applicable to Office client applications starting with Office 2013. Please read the tag info for additional guidance on how to increase the chance that you'll get a high quality answer to your questions.

For questions about the JavaScript and REST based Office Add-ins APIs.

Office.js is a JavaScript library developed by Microsoft and used to develop Office Add-ins (formerly Apps for Office). The library contains functions for every Office application (for example getting data selected by the user) and several objects and functions useful in the development of Outlook add-ins. The library allows you to develop three types of add-ins:

  • Content Add-ins
  • Task Pane Add-ins
  • Mail Add-ins

Content add-ins display and add-in application's contents within a window typically in the middle of an Office application. Task pane add-ins provide the add-in's content in a sidebar, and mail add-ins appear in the body.

Within the library, there are three main API's. The Shared API provides functions and objects useful to all types of add-ins. The Document API provides objects and functions useful in developing Content and Task Pane add-ins. The Mailbox API contains functions and objects useful for Mail add-in development.

Furthermore starting with Office 2016 and corresponding Office365 installations, there is a new set of richer functionality of APIs available for Excel and Word with many hundred new application specific functions available that allow developers to write rich add-ins for these applications.

Add-ins created using this library can run on any Office application regardless of device.

More information on this library may be found on dev.office.com.

When asking questions with this tag, please make sure to follow the points below

  • If you are encountering a new API error OR
  • If you are seeing issues on APIs that used to work OR
  • If you are seeing issues on APIs that are working on other devices / installations of Office

Make sure you to include your Office build version in the question.

should not be used for questions relating to Office Add-ins created using Visual Studio Tools for Office (VSTO) which have their own tag:

5489 questions
7
votes
0 answers

conversationId - how to detect a conversation between multiple users

The use case: We are creating a system which analyses mail content. If we are able to categorize and archive an email based on its content, we want to automatically categorize subsequent emails in the same conversation / thread. The issue is that…
7
votes
0 answers

Office JS application.createDocument() opens new window with closed add-in

We are loading a base64 document from the backend and opening it in our Word-addin (using Office JS APIs). We are using application.createDocument(base64) to do so. This causes the Word application to open an entirely new window for the new…
7
votes
1 answer

Enabling extended error logging in Office Add-ins (to see full statements on error object)

I'm developing an add-in and I'm encountering an error. A bunch of stuff is printed to the console, and some of it is: What does that mean? How do I enable that setting?
avi12
  • 2,000
  • 5
  • 24
  • 41
7
votes
1 answer

Sideloading Issue with OfficeJS Outlook Add-in on iOS

UPDATE #2: I have created OfficeDev/office-js#124 and OfficeDev/office-js-docs#1415 in order for someone at Microsoft to respond to this problem. Using Microsoft Support, both online and in the Outlook for iOS app, have proved fruitless. UPDATE…
Sameer Singh
  • 1,358
  • 1
  • 19
  • 47
7
votes
3 answers

Office 2016 add-in communicating to http://localhost

I'd like to build a Microsoft Office 2016 Add-in that could be used off-line (at least after being used online once). I understand that we could cache HTML, js, etc. like a normal browser and I had thought of using a local HTTP server (not…
Carles
  • 71
  • 1
  • 3
7
votes
1 answer

Is it possible to debug UI-less button for Office Add-ins?

I am trying to debug a UI-less button for an add-in for Outlook for Mac. In my code, the UI-less function in function-file.js. This is included in function-file.html, which is set as the FunctionFile url in the xml manifest. I also have the UI-less…
casvaart
  • 555
  • 1
  • 5
  • 14
7
votes
1 answer

Could someone provide a simple example of getting DocumentProperties in Office.js?

How do I get the author or title of a Word document using Office.js (1.3)? I read the documentation on documentProperties but I need an example to get the syntax right. Help appreciated!
11teenth
  • 1,853
  • 1
  • 15
  • 28
7
votes
4 answers

How to force Office UI Fabric ChoiceGroup to align horizontal

I am trying to build a SPFx webpart containing a ChoiceGroup. When I set the css style to ms-sm12 the choices are aligned vertical: Show assigned to: o anyone * me o nobody I like them to align horizontal in one row: Show assigned to: o anyone * me…
Dennis Kuhn
  • 239
  • 3
  • 10
7
votes
0 answers

Infinite redirect loop when issuing a router.navigate with Angular2 Router

Note Edit with relevant code snippets I have run into an odd issue where I get into a infinite redirect loop when issuing a router.navigate. Setup I use the hash location strategy and the app is used as an Outlook plugin. I have three routing…
Sameera Jayaseckara
  • 457
  • 1
  • 6
  • 13
7
votes
1 answer

"Add-In Warning. The license information for this add-in is missing or expired, so it may have limited functionality"

One of our customers is facing an issue while trying to activate an app created by them. The app is published as free of charge. Location: https://store.office.com/en-001/app.aspx?assetid=WA104379484&ui=en-US&rs=en-001&ad=US&appredirect=false It is…
7
votes
1 answer

VSTO in .NET Core

Microsoft recommends to develop Office add-ins using the new Office.JS Add-ins mainly because of cross-plataforming. We all saw a new player arriving, .NET Core. If Microsoft used .NET Core to create VSTO cross-plataforms, it would be awesome. VSTO…
7
votes
2 answers

How do you unit test office.js app code?

Are there any common practices, frameworks or patterns for unit testing office.js based code? Given the large number of the components in thr object model, it's impossible to mock calls to office.js. Is there something like a karma launcher to…
Sameera
  • 1,025
  • 13
  • 36
7
votes
2 answers

How to implement an 'undo' functionality for an Office Add-In using the JavaScript API

How to implement an 'undo' functionality for an Office Add-In using the JavaScript API? Right now all changes made by an Add-In are non-reversible by the user and it appears that Microsoft is not working on an easy way to enable the Add-In changes…
Jonas Kemper
  • 3,745
  • 3
  • 14
  • 21
7
votes
2 answers

How to programatically add a hyperlink to a cell in a worksheet using office-js?

I'm working on an Excel add-in using the JavaScript APIs to build add-ins in Excel 2016. The problem I have is not to place the url/link in the cell - I rather want to make this url clickable (as you may know it from entering a url into a cell and…
Eric Haas
  • 121
  • 1
  • 7
7
votes
2 answers

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

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. Support However, the above code opens support.html…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292