Office Development – Add-in Types, what did we have before?

Office-Development-VSTO_thumb.png

To research the ‘new’ Office JS Add-ins we need to know what types of add-ins there are. If you come from VSTO there is some similarity, add-ins can be divided in different types. Let’s see what we had before.

In VSTO you had the option to create Document Customizations aka Document-level customizations where the add-in was attached to the document or spreadsheet, Application-level customizations, here the add-in lives in the context of the host application like Word or Excel and Outlook Form Regions for customizations in Outlook

Project Type Feature Application
Document Level Customization Actions Pane Word

Excel

Custom Ribbon UI Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

Backstage View Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

Controls on Documents Excel

Word

Shortcut Menus Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

Application Level Customization Custom Task Pane Excel

InfoPath

Outlook

PowerPoint

Word

Custom Ribbon UI Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

Backstage View Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

Outlook Form Regions Outlook
Controls on Documents Excel

Word

Shortcut Menus Excel

InfoPath

Outlook

PowerPoint

Project

Word

Visio

So, in general there are these options explained a bit:

  • Actions Pane/Task Pane (Depending Application or Document Level)

    This is the pane on the right of a document that allows you to interact with the document. In case of an Actions Pane this is attached to the document, while the Task Pane can be there independent of the document. They can both do arbitrary things, but the Actions Pane only appears with the document.

  • Ribbon UI adjustments

    Adding your own Ribbon with controls on it. VSTO can add almost every Ribbon Control available.

  • Backstage View

    Backstage View is the view that you see when you select the File Tab. This allows you to add a special tab in there for whatever you want to show there. Some limitations apply

  • Outlook Form Regions

    Outlook Form Regions extend the way you work with your mail. There are options to just add a small part on top of the mail item or take over the full real estate. You can specify when this happens, will it be only in compose or read mode? You decide.

  • Controls on Documents

    With this feature you can enhance the document with extra controls on top of the document surface. The controls are not always persistent and you may need to re-create the controls each time you open the document if you want them to appear again.

  • Shortcut Menus

    These are the context menus. Right click on the document and add extra function call options within the right-click-menu to allow the user to do specific tasks related to the position of the caret (insertion point where the cursor resides).

This is quite a lot of functionality and also keep in mind that from most of these features you can do the craziest things because you can extend the Task Panes/Action Panes with either Windows Forms but also XAML interfaces. The other features can use the full .NET Framework stack so you can do everything you want.

The challenge is now to see if we can get the same things with Office JS Add-ins. Obviously you don’t want to fall back into a limited feature set. On the other hand, there is the fact that it needs to run on multiple platforms. That can be a limiting factor.

Given this summary I now have a goal to what to look for in the ‘new’ world.

To be continued …

Office Development–The Good

Office Development - Good

So after a small introduction to the “Ugly” VBA, the “Bad” VSTO, we end with the “Good” … well end … I guess the end is just the start of a new experience of an Office Development platform not familiar to most people. It is not included in the box like VBA, not using the languages most Microsoft developers are familiar with.

So what is it? Office Add-ins, yes … this time with the capital A, indicating that we discuss the –new- way of developing Office customizations, are built using well known web development technologies like HTML, CSS and JavaScript.

By doing so Office Add-ins run across multiple versions of Office:

  • Office for Windows Desktop
  • Office Online
  • Office for the Mac
  • Office for the iPad

This is most likely not all, with Office emerging on other platforms like Android and Linux distributions these options will be on the shortlist as well. We will research these options on a later time.

So how does this work?

The architecture is a little bit different than the other technologies, although you can debate that the Office Add-ins mechanism looks like the way it was done with VSTO.

This is how it looks like with the JavaScript Office Add-ins:

DK2_AgaveOverview01

There is an Add-in manifest in the XML format and a web solution hosted on an arbitrary web server. The image shows HTML + JavaScript but it can be more than that as long as valid web technologies are in place. The manifest contains all sorts of settings (we’ll dive in to see what is in there also later on) and it defines what Office clients are used and what it needs to run.

The Office JavaScript API first implemented some basic Excel features and even less Word features but today many more clients are supported and the Excel and Word features are getting more mature over time. The JavaScript API for Office contains objects and members that you need to build your add-ins and interact with content in your Office documents and web services.

If you look at the API you will see that you recognize a lot of your ‘old’ Office Object Model. Some are close to what they were, others needed to be adjusted and there are also new options.

Ok, the starter is here … in my next posts I will pick each of the items and look at the details. As I said earlier, this for me is probably like you a learning experience. I’ve been looking at it for years now in a helicopter/management overview but I decided I need to learn the ins and outs of the new platform. While doing so I try to teach you as well by blogging about it. Trying to keep it simple and getting more complex over time.

Let’s see if Office Add-ins are really the “Good” as advertised and can they do the same as we can do with VSTO add-ins….

Office Development–The Bad

clip_image002

Visual Studio Tools for Office (VSTO) is a set of development tools available in the form of a Visual Studio add-in (project templates) and a runtime that allows Microsoft Office 2003 and later versions of Office applications to host the .NET Framework Common Language Runtime (CLR) to expose their functionality via .NET.

Quote: https://en.wikipedia.org/wiki/Visual_Studio_Tools_for_Office

As we have seen in my previous blog post Office Development – The Ugly the first option to build your Office extensions using Visual Basic for Applications (VBA) did not win the beauty contest. A very powerful toolset to create beautiful and especially productive customizations. I’m sure that VBA, the tools to set Office to your hand, allowing you to tailor Office in a way that it perfectly fits the needs of your company, is one of the main reasons that made Office such a popular box of applications.

It was however risky – a potential security risk and code management is a pain. In the real world it happened that a ‘new’ version was rolled into production where all the sudden existing features ‘disappeared’ as a result of the developer picking the ‘wrong file’ containing an older version of the solution and continued developing features using the incomplete version.

This needed to change … in the meantime managed code -.NET- appeared at the horizon and the next option at least had to be a) secure and b) needed an improved source control option.

The solution Microsoft put on the table were the:

Microsoft Visual Studio Tools for the Microsoft Office System.

The product name was most likely the longest name available at that time. The Visual Studio Tools for the Microsoft Office System (VSTO) was architected as a bridge between Visual Studio and The Microsoft Office System. On one side the languages team with Visual Studio, on the other side the Office team and in the middle the VSTO team – code named Trinity …

clip_image004

So how is VSTO different compared to VBA?

Applications, add-ins or document customizations, are built using Visual Studio. Initially in a separate Visual Studio .NET 2003 VSTO SKU and after a few version inserted in the Visual Studio 2008 box. The code no longer lived in the documents or other Office files, but from now on lived in an external assembly that would be triggered by the Office host application if the right properties were available in the document.

Loading the assembly was done in a relative complex manner and it was made sure that security wise the pain seen with VBA would not exist with VSTO add-ins.

Here is a schematic overview of the load pattern:

clip_image005

As you can see the Office Application is looking at the Registry to see what add-ins are installed, if found any the Deployment manifest (pointed to by the Registry) is read and following that the Application manifest is read and the assembly loaded.

A real extension to the Office Application … to make this all secure the security is enforced at installation time. There was a whole slew of prereqs that must be covered before the add-in would be installed:

clip_image006

This part made VSTO the “Bad” in The Good, The Bad and The Ugly … it appeared to be a real pain for the IT Pros at the time. By default, VSTO used Click-Once to install the extension on the machine and a lot went wrong … certificates expired, not added to the Trusted Publisher lists, etc. etc. There was another option, to install an add-in using an .msi installer but the average VBA developer had a hard time getting around all of this, jumping all the hoops to make it work.

Was it all Bad?

Not at all! By using managed code, C# or VB.NET – whatever your preference was, your world of Office completely opened. Whatever you could do with .NET (and that is basically everything) you could add to your solution. Calling third party libraries, UI components, later even XAML UI interfaces, sky is the limit.

For me personally this is still my fav option to build Office customizations. I wasn’t awarded nine-year Visual Studio Tools for the Microsoft Office System MVP – I guess the longest MVP title as well, without reason. VSTO controlled my life for the large part of these years (hopefully my wife is not reading this ) did a lot of forum support in this area and built VSTO applications for large enterprise companies. At the time, we still had on Microsoft campus Software Design Review meetings to share feedback and we gave the team a hard time to make sure they released the features that we really needed.

Where to go next

But … the world changed, Windows is no longer the only platform that needs to be supported. Because of that a new mechanism was proposed. By using the common web standards and JavaScript a platform independent system was developed by providing OfficeJS APIs to access the Office object model from web based add-ins.

And this is where we will dive in soon. It’s a relative new world, although development already started years ago, so there is a lot to learn there. Let’s see if we can do the same with OfficeJS as we can do with VSTO – but now on multiple platforms and several clients.

Maybe I will return to VBA and VSTO in separate blog posts just for fun. There is just a ton of information to share on all off these areas.

Book

Oh, and if you really want to know the ins and outs of VSTO I really recommend you reading the VSTO bibles by Eric Carter and Eric Lippert: Visual Studio Tools for Office 2007: VSTO for Excel, Word and Outlook. It is a huge and heavy piece of reference with over a thousand pages of inside information.

Office Development – The Ugly

clip_image002[4]

In the short introduction in my previous post “Office Development–The Good, The Bad and The Ugly?” I was showing three of the main options to build Office add-ins (again I will use Office Add-ins with the capital A to indicate talking about the ‘new’ Office JS Add-ins as opposed to add-ins in general). In this post, I’m now going into the first of each of the options a bit: how to start and where to look for things.

The first option is Visual Basic for Applications (VBA). If you go back a long time, like I do, this was about your first option to customize your Office environment. None of the other options were around at the time. VBA is hosted within the individual host applications such as Word, Excel, Outlook, PowerPoint, Excel or even some other applications not limited Microsoft to but licensed by Microsoft to these other vendors.

Disabled by default

Straight out of the box you need to activate the option to be able to use VBA from the host application. In this case Word, you need to go into the File menu option, select Customize Ribbon and tick the option on the right under Main Tabs called “Developer”.

clip_image004[4]

After activating the option you will notice that the “Developer” Tab becomes visible:

clip_image006[4]

By selecting the tab, you’ll see options like “Visual Basic”, “Macros”, “Record Macro” and more.

Entering your first code

Ok, now it’s time to enter your first VBA code … we won’t be creating the good old “Hello World” but it sure comes close. Click the “Visual Basic” button to open the VBA Integrated Development Environment (IDE) the environment where you build and (test)run your application.

Let’s dive in now … open the VBA IDE as explained above, and enter the following lines:

Sub test()

   Dim DefinedVariable As String
UndefinedVariable = “test”
MsgBox DefinedVariable

End Sub

Like this:

clip_image008[4]

Running the code with function key F5 or stepping into the code with F8 until End Sub (the yellow line) you will see that Word is showing an empty dialog box where you expected the word “test” to appear if all variables were used correctly:

clip_image010[4]

The Ugly I

You will notice that I defined the variable “DefinedVariable” but I initialized the variable “UndefinedVariable” with the value of “test”. I did this to show you the first “Ugly” in VBA … Although you won’t get an error your application will show an unexpected result (well … if the mistake was made in real life)

What happened here is that VBA didn’t throw an error as you are perfectly allowed to initialize an undefined variable (the one called UndefinedVariable in the code) but you’ll find that the variable was displayed that you did not initialize, called DefinedVariable.

This, especially in larger applications will cause extremely unexpected results and if the variables just look alike it will take you hours to notice that you made a typo somewhere.

To avoid these issues “Option Explicit” was invented. By adding the line, VBA requires you to define all variables used in your application. So, if you use this and runs the code your will now see that an exception will be thrown to point out that you missed something here:

clip_image012[4]

Where is your code stored?

You built your first application, but you wonder … where is it stored. Well that is both the beauty and evil thing about VBA, it travels with the document (template, workbook, presentation … depending on your host application). The beauty because it is very easy to distribute, you just share the document, if it is about Word, to another person in your organization and they can run it. That is also -the risk- of being able to just share it, shady virus writers realized this and used it as a vehicle to spread their viruses in a fairly easy manner. Microsoft tried to solve this issue a little bit by differentiating between file naming. Documents containing VBA code are using extensions with an m like document.docm while ‘plain’ no code documents are named document.docx. It is good to know though, that the old extension .doc still exists.

The Ugly II

Lack of security and the risk of writing faulty code makes VBA the “Ugly” one of the three options. You are perfectly capable of creating the best and most intelligent tools using VBA and there have been some great examples that boosted productivity but it is just not “Enterprise” ready. It is hard to control and can cause a large impact on your support division within your company.

So, should you use it? Of course, you can use it whenever you feel it will help you being productive! I still use it myself … if I need to create some quick ‘n dirty solutions to avoid repetition in my “task for the day” it is really easy to record a few lines of code, edit it to fit your needs and run it.

I deliberately didn’t go into details of the VBA language. The reason for that is that I just wanted to provide a primer showing the three development options and my goal will be to dive into the “Good” (as considered today) option. If your want to know how to proceed with VBA I suggest you dive into the documentation behind the links below or find some introduction sites. The benefit of a toolset that has been around for such a long time is that there is a boatload of information available on the interwebs to get you started. This post is merely an introduction as part of the big picture called “Office Development” or as I called it “Office Development 2017”.

Documentation

https://msdn.microsoft.com/VBA/VBA-Language-Reference

Wikipedia

https://en.wikipedia.org/wiki/Visual_Basic_for_Applications

Office Development–The Good, The Bad and The Ugly?

Office Development - Good Bad Ugly

In my last post we’ve seen that there are just a whole list of options covered under Office Development. Just to get a starting point we start to focus on Office add-ins –without the capital A– first. With Office add-ins I mean Office add-ins in general, that is … from the early start to where we are today.

I know that these days the name Office Add-ins is considered to be the part where Office Add-ins are built using the OfficeJS APIs but in the early years you had Office add-ins in many forms and technologies.

The Ugly

Initially the only option to customize Office was by adding code using Microsoft’s Visual Basic for Applications (VBA). This was, or should I say is – it still exists and you can still use it, the embedded code engine running a subset of the full Visual Basic command set capable in addressing the Office Object Model to quickly build some Office automation functions to make life as an Office Worker easier. The language appeared to be very powerful and in the real world people built some crazy complex stuff with it.

The Bad

To add more structure to building Office add-ins a new development paradigm was developed. Still using the Office Object Model but this time using the managed languages such as VB.NET or C Sharp (C#).

Managing code with VBA could be a pain in the … Code traveled with the documents and when the document was copied another ‘branch’ was created and you would never know you were working on the latest version unless you managed your distributions very strictly. Also the declaration of variables wasn’t always enforced causing all sorts of runtime errors to surface just after releasing the production code.

By using this new way to build your Office add-ins or customizations (I will return on customizations vs. add-ins later in a separate blog post, that’s a story on itself) with the new tools: Microsoft’s “Visual Studio Tools for the Microsoft Office System” (VSTO) at least you had a better control over your source code and you could even use Source Control to keep track of your code versions.

With this, the first versions of VSTO, seemed to be very hard when it came to installing the add-ins. Security was improved a lot, but that came at the high price of tough installation issues.

The Good

In these days, deploying add-ins can’t be limited to the Windows Platform so another change was rising … these are the add-ins built using the combination of well known web technologies and by including a Manifest you are now able to run your Office Add-ins (with the capital A) on all platforms in all supported and still growing number of client applications. Currently the client applications are Excel, Outlook, PowerPoint, Word and recently added Project, Access and OneNote.

Really?

Are these three technologies really The Good, The Bad and The Ugly? Well no, obviously not, you can still build add-ins in all three of these technologies but VBA for instance always had a very bad name, also caused by virus developers using this technology to harm innocent computer users by exploiting the technology to take over the computer and in worst case disable it.

VSTO was considered to be a real improvement but this technology also had his downsides. Deployment could be really hard, but this improved in later versions. Still going multi platform was no option for VSTO.

So is all good with the OfficeJS add-ins? Again, not at all … for starters these technologies used here are in general very hard to understand when you come from the VBA or managed code languages. Also, the APIs are not fully completed.

It still isn’t possible to do all the things that you could do with VSTO. With VSTO there is not really a limit. Whatever you can do with managed code you can do with VSTO as it just is interfacing between Office and .NET. This of course in itself could be very dangerous and should be managed to the max. Also VSTO is used by shady guys building malicious code.

We will get more in detail (we are still diving in, going deeper and deeper at this time) in my following blog posts so subscribe and join me in this adventure called Office Development!

Office Development – Where to Start

Office Development – Where to Start

clip_image002

Starting at dev.office.com you see a wide variety of options related to Office Development. There are a couple of sections to identify when you enter the Getting Started entry

  • Microsoft Graph
  • SharePoint Add-ins
  • Office Add-ins
  • Office 365 Connectors

Apparently, this is not all, as below the four options there is another option:

Can’t find what you’re looking for? Check out this full list of all development options for Office linking to the URL https://msdn.microsoft.com/en-us/office. If you follow this URL you’ll notice that it is redirected to, you might have guessed it: https://dev.office.com/docs, the documentation part of dev.office.com.

Here the options are not limited to the options above but now you can see there are sections for:

  • Microsoft Graph
  • Office Add-ins
  • Office 365 Connectors

And below this

  • Office Clients
  • Outlook.com
  • OneNote
  • SharePoint
  • OneDrive
  • Yammer
  • Exchange
  • Skype

Wait …, what …, why is there a section Office Clients separated from the Office Add-ins?

Well, I don’t know. Looking at this it you might think the ‘older technologies’ are under the ‘subsections’. This is true for Office Clients, covering:

  • Office 2013
  • Office 2010
  • Visual Basic Reference

The last item in the list is in fact incorrect, and should have been called “Visual Basic for Applications Reference” or “VBA Reference” or even better “Language Reference VBA” as it redirects to Language reference VBA. It has nothing to do with Visual Basic. Sure Visual Basic resembles a lot compared to Visual Basic for Applications (I will reference to VBA from now on for Visual Basic for Applications) but it isn’t the same. It’s as if you compare Visual Basic to VB.NET they aren’t the same either.

To continue the ‘older technologies’ theory … under SharePoint you find:

  • SharePoint Framework
  • SharePoint WebHooks
  • SharePoint Add-ins
  • SharePoint 2013
  • SharePoint 2010

In this case you see a combination of older and newer technologies. Also under the other subsections you find a mix of newer and older technologies (Exchange) or just newer technologies (Outlook.com, OneDrive, Skype, OneNote and Yammer).

There are even parts missing on this part of the documentation. What about Microsoft Teams as a newer application of Office or existing applications like Microsoft Access. Office and therefor Office Development is just huge, we can spend so much time on these sections, there is no end in all of this.

To start the research, I first want to focus on the Office Clients and their Add-ins. The reason for this is that this was the part that was applied the most when you look at Office customization (adjusting the Office client applications in a way that it suited the needs of the productivity workers).

So, I will drill down from the part covered under Office Clients and move over from there to the section Office Add-ins. This will provide a sense of history and slowly move into the newer technologies as provided in the OfficeJS APIs.

Enough stuff to dig in, so hang in there … see you in my next blogpost(s)

SharePoint Framework Extensions Developer Preview now available

SharePoint Framework Extensions Preview

Today the Office Team announced the availability of the SharePoint Framework Extensions Developer Preview. With this you can build site, list and command extensions.

To start building your own Extension Preview projects you can go and start looking at the Preview documentation. If you don’t already have an Office 365 Developer Tenant you can get one if you go to the Office Developer Program so there is no argument not to start using that.

The preview is obviously meant to serve as a way to collect feedback from the community and while the preview is running you can expect new SharePoint Framework Extension capabilities and changes based on your feedback.

If you want to provide your feedback you can do this by adding issues to the GitHub issues list but on the SharePoint tech community, the SharePoint Developer section on the Microsoft Tech Community site.

To give you an impression of what the SharePoint Framework Extensions Developer Preview brings, here are three:

1. Build your own Custom Banner using the ApplicationCustomizer.

Adding a Custom Banner is now one of your options to build your own banner with exactly the information you want to share on your list page.

1. Custom Banner SP

2. Create your own Custom Field Rendering using the FieldCustomizer.

In this example you see that the fields of the list are blurred to hide sensitive list information.

2. Custom Field Rendering SP

3. Adding Command Extensions with CommandSet

With this option you can add your own custom menu actions to be able to trigger your own custom actions.

3. Custom Extensions

If you are looking for more examples (extensions examples will be added soon) for what you can do with SharePoint there is a special SharePoint Showcase site for you to look at and to enjoy all the great options and examples.

Now go ahead, and build your own Extensions using the SharePoint Framework Extensions Developer Preview!

Office Development at //Build/ 2016 – 2 – Graph Changes

snip_20160419224647

Microsoft Graph is a gateway to data and insights in Office365 allowing you to easily traverse over objects and relationships to access the information that is sitting in the Office365 services using web standards. Microsoft Graph is an open platform accessible through a secure data access mechanism.

Microsoft Graph API developer stack.

At Build, with regards to Microsoft Graph the following changes have been announced for General Availability:

  • Webhooks on Outlook Entities
  • Access to consumer services OneDrive and Outlook.com
  • OneDrive large file upload/download

The following, but not only this – there is more, went in preview:

  • Excel REST API
  • Administrative Units
  • Find Meeting Time API
  • Get/set out of office
  • Online meeting links
  • Updates to People API
  • Updates to trending APIs

Documentation on Microsoft Graph can be found at:

Microsoft Graph: The easiest way to call

Office Development at //Build/ 2016 – 1 – The numbers

As you may know I have been visiting Build 2016 the last couple of days, and I plan to get into some more detail of the announcements made at Build this year. A lot of the ‘smaller’ announcements did not make it into the keynotes so hopefully I can share some information with you that you didn’t already hear before. Even if you did it is nice to have a little recap of what goes on right now.

The numbers:

SNAGHTML3b5aa4

  • 1.2B Office Users
  • 85% of Fortune 500 have at least one Microsoft Cloud Offering
  • 4T+ emails sent with O365 to-date
  • 50K+ new O365 small businesses per month
  • 340M downloads of Office mobile
  • 3B minutes of Skype calls daily
  • 1B+ meetings created per month
  • Microsoft Graph API calls 420% monthly growth

The numbers are impressive, but what is it to you? You are probably only one of these users and who cares? Well, the point is, as an Office Developer there is just a huge big open market to target. Build your tools properly and you have 1.2B potential customers of your tooling. The other thing is that more or less Office is the -standard- for most people or at least provides you with the output that everyone is able to read/use, even the ones using tools from competitors.

Happy wishes and some Office predictions for 2016

MVP_Horizontal_FullColor

Another year has gone, a new year started … this is 2016. Welcome!

My year, for the eleventh time already, started with receiving the Microsoft Most Valuable Professional (MVP) Award again.

After nine years of receiving the award for Visual Studio Tools for the Office System (VSTO), one year of Office365 I now, after the award update, received the award in the award category “Office Servers and Services”. This is where all former Office365, Exchange, SharePoint, Skype for Business and Yammer are grouped today. As of October 2015 the MVP Award categories have changed, there are now less categories and in theory you can get the MVP Award in multiple categories.

So what will bring 2016 to you and me? Well nobody knows… so I don’t know either, but let’s see if we can make some educated guesses here.

2015 was the year Office Microsoft released some early updates on the Office 365 APIs. Starting with the outer ring of Office365 we got access to files, contacts and much more. Access to the documents itself (the structure of the document, in VBA the Object Model) was fairly limited.

In 2016 I expect to see much more APIs providing access to the Office document model. This will give you the functionality, but now cross-platform, like you used to see with VBA, COM-Addins and in VSTA/VSTO solutions.

Let’s see how the Office365 APIs progresses in the year of 2016. Join me in the process of learning the ‘modern’ ways of developing Office solutions on x-plat. Keep an eye on my blog …