The launch of Office 365 in 2011 brought big changes to the way Office add-ins were developed and shipped. The old COM plugins were deprecated, and Microsoft began to move developers to a new cross-platform JavaScript-based add-in model.

It was a change that made sense. The iOS release of Office was just around the corner, as was a major update of the macOS release. These weren’t the only changes to the Office suite, as Microsoft was working on a web-based set of Office applications. The new add-in model allowed the same add-in to run anywhere where Office was, so developers could write code once and know that it would work on mobile, on PCs, and on the web without any changes.

As well as being cross-platform, the new add-in model built on a common set of technologies that would become the Microsoft Graph, bridging the familiar Office applications and providing tools to allow information from one application to be consumed by another. Each add-in is at heart a small web application, hosted on a server, and behaving much like any application in a browser. You’re not limited to one way of developing an add-in; you can use any web framework you want, whether it’s a browser-side technology like React or Angular or a server-side tool like ASP.NET or Node.js. You’re not limited to where the add-in runs; it can use your own server or any host, even a cloud provider like Azure.

Developing Office add-ins

The Office add-in programming model anticipated many modern, cloud-native programming techniques. Add-ins provide a manifest to their host application, with hooks for ribbon buttons and menu commands. Once the UI elements are in place, the add-on loads and runs in its own secure sandbox. There’s no access to the rest of your system, making it a more secure approach than the old COM add-ins. Apps are shared through Microsoft’s AppSource store, and can be free or paid-for, either using a one-off charge or a recurring subscription.

Interactions with Office are handled by the Office.js JavaScript APIs. These provide the hooks where your code can link with Office, adding new functions or creating new objects, and working with the Office UI via the ribbon, menus, and new task panes. There’s a lot of scope for building add-ins with Office 365’s platform, as they are relatively simple to build and distribute. It’s an evolving platform, changing as Microsoft updates and upgrades Office 365.

That’s perhaps one of the more important aspects of the Office Developer platform; while older add-ins continue to operate, new APIs and new versions of existing ones allow your code to evolve with Office. Microsoft releases new builds of Office 365 regularly, with Insiders getting new code weekly.

Developers get access to a sandboxed Office 365 E5 subscription, allowing you to test and develop your code without affecting your live mail and document collaborations. Microsoft provides sample data for the developer tenant, with 16 fake users, complete with email messages and calendar events. You can then use the sample data to test your add-ins on real data.

New features for 2021

2021 is shaping up to be an interesting year for Office developers, with Microsoft adding new APIs, features, and UI tools to the platform. At the same time, it’s committing to ensuring platform stability, while improving how users will be able to install and manage add-ins.

One of the more important updates for 2021 is the launch of event-based activation support in Outlook (now available in preview). Instead of a user having to trigger an add-in from the ribbon or a menu item, Outlook offers a set of events that can be used to launch a task automatically, without having to show a UI. These include when a message composition window is opened, when you create a new appointment, when you change the attachments in a message, among others. The events may seem simple, but they allow you to build new workflows around Outlook — automatically adding a room booking to a meeting, for example, or making sure that messages always have a manager in the CC field. You’ll need to add event handling code to your application, and can only use a subset of the Office.js APIs as event-driven code can’t change the Outlook UI.

A useful new feature supports adding keyboard shortcuts to Excel add-ins. Excel power users often prefer the keyboard to the mouse, so adding shortcuts will make it easier for them to work with add-ins. They’re important for users with disabilities, and it’s worth adding them to your existing add-ins to increase accessibility.

SEE: Python programming language: A cheat sheet (free PDF) (TechRepublic)

PowerPoint will get a whole new set of capabilities, initially in the web version. It has not been easy to automate PowerPoint operations in the past, and the new APIs should make it easier to build code to both help design and run presentations.

Other new features let you take advantage of Office-specific UI features. One option supports the creation of custom control groups in the ribbon. You’ll be familiar with these from using tools like Office’s search. When you start a search, a new tab appears in the ribbon bringing together all the search-related features that aren’t normally visible. It’s possible to imagine a set of tools that link Word to a content management system, for example, appearing when you trigger a content management task. Saving to an enterprise CMS, for example, could open a new ribbon tab with edit and publish commands, as well as tools to help categorise content and add it to groups.

There’s a lot to like in the Office add-in model. It’s mix of cross-platform features and a familiar JavaScript programming mode make it easy to pick up and get started, building and sharing add-ins. Microsoft’s latest updates show that it’s committed to the platform’s future, and to making the add-in model a way of extending Office 365 into more than other applications, making them part of the way businesses work. Turning a business process into an Office add-in reduces the risk of error, while keeping users focused on tasks and avoiding distractions.