Microsoft Brings JavaScript Developers to Office 365 With CORS Support

New capabilities help JavaScript developers build responsive Web apps for the company's growing cloud-based productivity ecosystem.

new features for building Web apps

Just as Microsoft's is narrowing the gap between the native and browser-based versions of its productivity software with Office Online, the company is laying the groundwork for full-featured and responsive third-party Web apps that hook into Office 365.

"The OneDrive for Business and Sites APIs now have cross-origin resource sharing (CORS) support and Mail/Calendar/Contacts are coming soon," said Jeremy Thake, product marketing manager for Microsoft Office 365, in a March 6 announcement. As the term suggests, CORS enables Web developers to securely request resources from another domain.

In this implementation, coders can streamline the development of apps that hook into Microsoft's cloud services. Meanwhile, users are treated to snappier, more responsive Web apps, he said.

"Developers now have the choice to call the Office 365 APIs [application programming interfaces] from the server-side or client-side," Thake said. "This means developers can write single-page applications, which have a better user experience and better performance, because they don't have to proxy all their calls through a server-side façade service."

To help developers get the ball rolling, Microsoft has published new documentation detailing the particulars of getting JavaScript single-page apps to work under the new system. For a taste of what's possible with CORS, the company also released sample code.

"The 'Expense Manager' scenario was originally written with an ASP.NET Web API server-side component to call the Office 365 APIs," Thake said. "Now, with the Active Directory Authentication Library JavaScript (ADAL.JS) libraries, the sample has been refactored to be purely client-side."

ADAL.JS, broadly available since Feb. 19, set the stage for CORS support in Office 365 APIs. "The ADAL.JS library makes it significantly easier to handle authentication in your Web applications in JavaScript. This makes the code much cleaner and handles the authentication for you," added Thake. "Most business applications will have a server-side API component for user authentication into the Web application itself for security reasons."

And there will be no shortage of resources as the company drums up cross-platform support for its cloud-enabled productivity suite.

"In addition, there is also a series of hands-on labs for building apps for Office in Outlook, Word and Excel with the Brackets IDE [integrated development environment] and a Web browser," said Thake. "This illustrates the desire for the Office 365 platform to be open for developers on all platforms."

More integrations are in the works. "As more Office 365 API endpoints come online for services, they will also support this including Office Graph, Yammer, Video Portal, Skype and content services," Thake said.

CORS support in Office 365 isn't the only way Microsoft is making waves in regards to JavaScript. The company announced that it is joining its fierce rival Google to work on Angular 2, a new version of the latter's JavaScript framework. As part of the collaboration, the companies are unifying their separate JavaScript technologies with the aim of simplifying Web development.

Pedro Hernandez

Pedro Hernandez

Pedro Hernandez is a contributor to eWEEK and the IT Business Edge Network, the network for technology professionals. Previously, he served as a managing editor for the network of...