I find the easiest way to create (scaffold) a new Office Add-in (Outlook, Word, Excel, PowerPoint) is to use the Office Yeoman Generator (Yo Office).
This is really using 2 things. Firstly its using a tool called Yeoman, which is a generic scaffolding tool (nothing to do with Microsoft or Office). It’s the Yo in Yo Office. By itself it’s not very useful, it’s like the New Project menu in Visual Studio; the New Project menu does nothing without the templates of different project types available underneath. In Yeoman terms those new project templates are called Generators, and there happens to be one for creating Office add-ins. It’s called the Yeoman Generator for Office-Addins. That’s the Office in Yo Office. Yo Office is actually the command you can type at a command line that launches the Yeoman Generator tool and tells it to scaffold a new Office Add-in using the generator. Ok, enough with the background, the focus of this article is to collate the commands and info necessary to download and install both the Yeoman tool and the generator for Office Add-ins, and how to check what versions are installed and update them to the latest. There seems to be plenty of articles published about doing this for the SharePoint generator but not so much coverage for the Office Add-ins generator so here we go…
Open a Command Line window and type the following command (doesn’t matter which directory you are in)
npm -g outdated
This will tell you all the npm packages that are outdated. In the case above you can see I’ve got the generator for Office installed but it’s not the latest version. Outdated packages will include both the Yeoman engine itself and any Yeoman Generators (since they are all just npm packages).
If you want to verify exactly what versions of the engine and generators you have installed then use the command
npm ls -g --depth=0
This lists all top level npm packages. Above you can see I’ve got a larger list this time that includes the Yeoman engine (Yo which is at version 3.1.1)
To update the Yeoman engine to the latest (or if you find that you don’t have the Yeoman engine installed at all yet), use the following command
npm install yo@latest -g
To update the Office generator to the latest (or to install it for the first time if you don’t have it yet), use the following command
npm install generator-office@latest -g
An alternate (and easier way especially if you want to update all your generators to the latest version) is to use the following command
Then simply select the option to Update your generators
You then get to select which generators (or all) to update
Leave a Reply