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
26
votes
8 answers

Console log in Javascript Office Addin

I have a question about "console.log" in Javascript Web Office Addins. Currently I am working on Javascript Word Addin and can't troubleshoot it, because I don't understand where the "console.log" output is sent. On Microsoft site there are a lot of…
Alexey Zelenkin
  • 701
  • 1
  • 6
  • 13
24
votes
3 answers

Office.js nullifies browser history functions breaking history usage

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…
19
votes
0 answers

Office js Web Addin failing to ExpandDL with soap call

I'm currently working with an Outlook Web Add-in with Office.js. In this project, we require sending mail merge emails to handle Distribution Lists and Groups. We use the ExpandDL call and our soap request looks like:
17
votes
3 answers

How to get the organization (tenant) id from user profile using the Microsoft Graph API

I'm creating an add-in that I to sell using organizational licenses. I have implemented an authentication scheme on the add-in. I'm currently asking for User.Read scope for a sure authenticating using and Azure v2 endpoint. To get the user's…
seebiscuit
  • 4,905
  • 5
  • 31
  • 47
14
votes
4 answers

Uncaught TypeError: window.external.GetContext is not a function

I have created an angular app and wanted to use JS API library into it. I want to use this app inside Office 365 Outlook. However, I am getting the following error: Uncaught TypeError: window.external.GetContext is not a…
Spartan
  • 191
  • 1
  • 9
13
votes
2 answers

Is Office.context.ui.messageParent broken in Outlook 2016 for Mac?

I'm working on an Outlook addin using the new Office-JS apis, and in building out the authentication flow, I've found that in the Outlook 2016 for Mac case, the dialog system seems to not work properly. To be clear, we're using the Office Insider…
Ava
  • 337
  • 1
  • 10
10
votes
1 answer

Office.js Word - window.external.RegisterEvent is not a function

I am developing a Word 2016 Addin and I have received an error from a client (logged via Sentry) that I'm having trouble reproducing. It occurred in a Dialog window on macOS Sierra 10.12.6 in Word 16.11. window.external.RegisterEvent is not a…
Craig Sketchley
  • 330
  • 2
  • 13
10
votes
4 answers

Cannot find name 'Office'

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 () { …
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
10
votes
1 answer

How to send back MS word cursor focus on current document after click in Task Pane

I have developed a Word Add-in using word java script API. When i click in Task pane to do some action the cursor focus removes from current document, i am not able to edit the document until click back on the document. Please advice me how i can…
10
votes
2 answers

Office VSTO Add-ins vs Office Add-ins using Office JS API

Recently Microsoft introduced the Office Add-ins architecture which allows for developing add-ins hosted remotely and run within IFrames inside office. I have read a lot trying to understand whether this architecture is meant as a replacement for…
Bahaa
  • 1,577
  • 18
  • 31
9
votes
0 answers

office.js offline in windows 10

Since upgrading to Windows 10 we can't get Office Javascript API running offline in Word. We're running Word build 16.0.4639.1000 64-bit. Previously over last year we've been running the Office Javascript API successfully against Word 2016 (same…
9
votes
2 answers

OnSend fired twice after attachment reminder

In Outlook Web Add-In, I'm trying to intercept OnSend event which is triggered when sending an email. I used this example in GitHub which is working fine. If I include the word "attachment" in the email body and I click Send button, OnSend event is…
Mhd
  • 2,778
  • 5
  • 22
  • 59
9
votes
3 answers

Check if Office.js is loaded outside of Office client

If we load a webpage referencing office.js outside Office client, we will get a warning: Office.js is loaded outside of Office client. This information is useful. Does anyone know if there is an API to check that inside my code? Edit 1: I explain a…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
9
votes
1 answer

Worksheet freezes when scrolling on task pane during task execution

We are developping an office Addin with office.js API. A recurrent problem damage our reputation in the store. This problem is that the worksheet in a Excel Addin (office.js) is freezed after scrolling over it. I've written a simple Script Lab…
Sami.S
  • 267
  • 1
  • 13
9
votes
2 answers

Do Office Add-ins always require Internet access to work?

Let's take Excel for example. In Excel 2016, when I select an add-in in the STORE, after clicking on Trust It, will the code (.html, .js files) of the add-in be downloaded or installed on my machine? In other words, have the add-ins under MY ADD-INS…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
1
2 3
99 100