Update to the latest Office JavaScript API library and version 1.1 add-in manifest schema

This article describes how to update your JavaScript files (Office.js and app-specific .js files) and add-in manifest validation file in your Office Add-in project to version 1.1.

Note

Projects created in Visual Studio 2019 or later will already use version 1.1. However, there are occasional minor updates to version 1.1 that you can apply by using the techniques in this article.

Use the most up-to-date project files

If you use Visual Studio to develop your add-in, to use the newest API members of the Office JavaScript API and the v1.1 features of the add-in XML manifest (which is validated against offappmanifest-1.1.xsd), you need to download the latest version of Visual Studio. To download Visual Studio, see the Visual Studio IDE page. During installation you'll need to select the Office/SharePoint development workload.

If you use a text editor or IDE other than Visual Studio to develop your add-in, you need to update the references to the content delivery network (CDN) for Office.js and the version of schema referenced in your add-in's manifest.

Updating an Office Add-in project created with Visual Studio

For projects created before the release of v1.1 of the Office JavaScript API and add-in manifest schema, you can update a project's files using the NuGet Package Manager, and then update your add-in's HTML pages to reference them.

Note that the update process is applied on a per-project basis - you'll need to repeat the updating process for each add-in project in which you want to use v1.1 of Office.js and add-in manifest schema.

Update the Office JavaScript API library files in your project to the newest release

The following steps will update your Office.js library files to the latest version. The steps use Visual Studio 2019, but they are similar for previous versions of Visual Studio.

  1. In Visual Studio 2019, open or create a new Office Add-in project.
  2. Choose Tools > NuGet Package Manager > Manage Nuget Packages for Solution.
  3. Choose the Updates tab.
  4. Select Microsoft.Office.js. Ensure the package source is from nuget.org.
  5. In the left pane, choose Install and complete the package update process.

You'll need to take a few additional steps to complete the update. In the head tag of your add-in's HTML pages, comment out or delete any existing office.js script references, and reference the updated Office JavaScript API library as follows:

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>

Note

The /1/ in the office.js in the CDN URL specifies to use the latest incremental release within version 1 of Office.js.

Update the manifest file in your project to use schema version 1.1

In your add-in's manifest file, update the xmlns attribute of the <OfficeApp> element changing the version value to 1.1 (leaving attributes other than the xmlns attribute unchanged).

<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xsi:type="ContentApp"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://schemas.microsoft.com/office/appforoffice/1.1">
  
  <!-- manifest contents -->

</OfficeApp>

Note

After updating the version of the add-in manifest schema to 1.1, you will need to remove the Capabilities and Capability elements, and replace them with either the Hosts and Host elements or the Requirements and Requirement elements.

Updating an Office Add-in project created with a text editor or other IDE

For projects created before the release of v1.1 of the Office JavaScript API and add-in manifest schema, you need to update your add-in's HTML pages to reference CDN of the v1.1 library, and update your add-in's manifest file to use schema v1.1.

The update process is applied on a per-project basis - you'll need to repeat the updating process for each add-in project in which you want to use v1.1 of Office.js and add-in manifest schema.

You don't need local copies of the Office JavaScript API files (Office.js and app-specific .js files) to develop anOffice Add-in (referencing the CDN for Office.js downloads the necessary files at runtime), but if you want a local copy of the library files you can use the NuGet Command-Line Utility and the Install-Package Microsoft.Office.js command to download them.

Note

To get a copy of the XSD (XML Schema Definition) for the v1.1 add-in manifest, see the listing in Schema reference for Office Add-ins manifests.

Update the Office JavaScript API library files in your project to use the newest release

  1. Open the HTML pages for your add-in in your text editor or IDE.

  2. In the head tag of your add-in's HTML pages, comment out or delete any existing office.js script references, and reference the updated Office JavaScript API library as follows:

    <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
    

    Note

    The /1/ in front of office.js in the CDN URL specifies to use the latest incremental release within version 1 of Office.js.

Update the manifest file in your project to use schema version 1.1

In your add-in's manifest file, update the xmlns attribute of the <OfficeApp> element changing the version value to 1.1 (leaving attributes other than the xmlns attribute unchanged).

<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xsi:type="ContentApp"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1">
  
  <!-- manifest contents -->

</OfficeApp>

Note

After updating the version of the add-in manifest schema to 1.1, you will need to remove the Capabilities and Capability elements, and replace them with either the Hosts and Host elements or the Requirements and Requirement elements.

See also