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
1 answer

how to handle date type in excel addin office.js

i have a task-pane based add-in for Excel developed using office.js. i copy a date on one of the cell in the excel, and then read it next time from that cell. basically i use javascript Date object to convert the read string from excel to date and…
shyam_
  • 2,370
  • 1
  • 27
  • 50
7
votes
3 answers

How to find the Office AddIn Host it is a Word application or Excel using office.js?

I am creating a office AddIn which works in both excel and word applications and based on host if it is a word or excel host i want to execute different logic. I am using office.js to create office Addin. for example :- let say type="Excel" //…
Pradeep Gaba
  • 415
  • 3
  • 17
6
votes
1 answer

Tracking Prevention blocked access to storage for https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js

I wrote an Excel add-in using the OfficeJS API about a year and a half ago and it has been working until about two weeks ago. It seems like Excel has had an update where I'm now allowed to right click on the taskpane and see dev tools, where I…
WTFranklin
  • 2,454
  • 4
  • 21
  • 28
6
votes
5 answers

Add-ins missing in "New Outlook" for Outlook for Mac users

I work on an add-in for Microsoft Outlook, and some of our Outlook for Mac users have recently reported that they are unable to view any add-ins in the ribbon if they have the "New Outlook" toggle turned on. The option "Get Add-ins" is accessible…
6
votes
1 answer

When should we drop the SSO access token?

TL;DR - How do we expire the access token when the user signs out in another tab? Details: In the SSO documentation it says: When to call the method If your add-in cannot be used when no user is logged into Office, then you should call…
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
6
votes
1 answer

Outlook-addin not working with offline office.js downloaded from GitHub

Outlook add-in using offline office.js library downloaded form GitHub is not working when internet is blocked. Office.js library is hosted on a local server.