BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Introducing Napa – A Web Based IDE for Outlook/SharePoint

Introducing Napa – A Web Based IDE for Outlook/SharePoint

This item in japanese

VBA, the macro language for Office, is essentially at a dead end. Based on COM version of Visual Basic, it is stuck with a technology that hasn’t had a meaningful update in over a decade. Visual Studio Tools for Office exists, but isn’t available to non-professionals and can be difficult to use due to the mismatch between COM and .NET technology. And then there SharePoint, which has never had a good story for casual developers. Toss in the need for macros in the hosted version of Office and SharePoint and you end up with quite a mess.

This is where Project Napa enters the seen. Somasegar introduces Napa as,

“Napa” provides a lightweight, browser-based companion to the Visual Studio rich client and is a great way to get started with Office and SharePoint development without having to install anything onto your machine. Available through http://dev.office.com/, it supports building apps for Office and SharePoint, apps which can be surfaced through an Office 2013 application (e.g. Excel), through an Office Web App (e.g. Excel Web App), or through SharePoint. These apps are based on a new Cloud App Model, where UI and other client-side logic is implemented with web standards (e.g. HTML, JavaScript, CSS) and where any back-end app logic runs on a server, giving developers the freedom to use their choice of development tools, languages, and hosting environments.

Using straight JavaScript may turn out to be problematic. Even under ideal circumstances language isn’t as friendly to casual users as Visual Basic. Long standing inconsistencies in the syntax, case sensitivity, and the use of characters instead of keywords can conspire against the novice programmer. These are not insurmountable, but the way the JavaScript is used may prove to be.

To create a button one of course needs a function to receive the click event. This is pretty much the same in any language, the difference is in how you wire it up. In VB (COM or .NET) the function is attached to the button declaratively. In C# one uses the event handler syntax, which takes a single line of code.

In the example offered by Somasegar, you need to assign an anonymous function to Office.initialize. This anonymous function calls $(document).ready, passing in a second anonymous function. Inside that function is a third anonymous function that attached to the button’s click event using another jQuery operation. This kind of function nesting may be acceptable to skilled web developers, but is not appropriate for someone trying to create a simple macro in Excel.

Fortunately you don’t have to write code that way. As seen in this walk through, one can still choose to use traditional JavaScript techniques from the late 90’s. With some basic instruction on HTML and Office’s async model, the casual developer should be able to build simple applications.

Using Napa requires you to sign up for an Office 365 developer site.

Rate this Article

Adoption
Style

BT