Today many application and service developers integrate their source code with sophisticated tools and practices.
One of these is Visual Studio Team Services. In this blog post, we will look at installing the manifest file of an Outlook add-in into an Office 365 tenant as part of the build process. We will be achieving this by using a Visual Studio
Team Services extension called Office Outlook Add-In Build/RM Tasks – created by Max Knor (http://blog.knor.net/)You can get started for free with Visual Studio Team Services here: https://www.visualstudio.com/en-us/products/visual-studio-team-services-vs.aspx
Let’s get to it. I’m assuming you already have an existing Outlook add-in project, that you’d like to integrate with Visual Studio Team Services (VSTS from now on). If you’d like to get started with building Outlook add-ins, read more here: http://simonjaeger.com/create-a-read-mode-mail-add-in-for-outlook/
Head into your VSTS and create a new team project from the Overview tab section by clicking on the New button.
Give your team project a name, choose a process template and the version control. Finalize the creation by clicking on the Create project button. I will be using git as the version control for my team project, but you can choose anything that suits your own needs.
Your next task is to get your project (source code) into the team project. If you’re using git, you can follow along here. In the code tab section of your team project, you’ll find the Clone URL. Copy it for the next step.
I’ll use my Command Prompt to clone the repository (with git clone [CLONE URL]), using the clone URL. If you are using any other tool, clone the repository as you wish.
Be aware here, if you find your repository to be cloned with the %20 characters (instead of spaces) – go ahead and edit the folder name. If you don’t do this, you run into errors when dealing with any NuGet packages in your project.
Now add your source code to the git folder. In addition, I will also add a copy of the live manifest file in the root. Which we will pick up in the build process and install it into the Office 365 tenant. You can do this in various of ways, just make sure that you can access or reference the manifest file while configuring your build definition.
I’ll push all of the above content (project and manifest file copy) into the git repository in VSTS using the following git commands.
- git add -A
- git commit -m “Initial Commit”
- git push origin master
Now head to the Visual Studio Marketplace and find the VSTS extension we are going to use: https://marketplace.visualstudio.com/items?itemName=knom.office-mailapps-task
Click on the Install button. In the following prompt, choose the VSTS account that you created the team project within and click on the Confirm button.
You should now be ready to created the build definition. Head back into the VSTS team project, and click on the build tab. In here, click on the New definition button. As my (and most likely yours) project is created with Visual Studio, I’ll choose the Visual Studio template. This will fill the build definition with a preset of already defined tasks (such as restoring NuGet packages, cleaning the project, etc.) – giving us a great start. Head into the next step by clicking the Next button.
Choose your own team project as the repository source. Be sure the check the Continuous integration checkbox. This will allow the build definition to be queued up whenever a new commit has been pushed into the repository. Click on the Create button to finalize the setup.
We will leave the template as it is, but we will extend it with the Outlook add-in specific installation task. Click on the Add build step… button. In the Utility tab, find the Install Office Outlook Add-in task and click on the Add button for it.
In the newly created Install Office Outlook Add-in task, navigate to the manifest file for the Path to the application’s manifest xml file property. Be sure that you’re picking a “published” manifest file, that has passed the Office manifest validation and doesn’t contain any ~remoteAppUrl keywords. See the following link for more information on validating the manifest file: http://dev.office.com/docs/add-ins/overview/add-in-manifests
As for the Exchange Endpoint property, go ahead and click on the Manage button. This will take you to the Control Panel of the team project.
In the Services tab, click on the New Service Endpoint button to create a new service endpoint. Choose the Generic type. This connection serves as the connection between the build process and your Office 365 tenant.
Enter a name for the connection and specify the Server URL as https://mail.office365.com/. Lastly supply the credentials for a user in your tenant with enough privileges to install Outlook add-ins. Click on the OK button to create the connection.
Head back to your VSTS team project and choose the new connection as your Exchange Endpoint property for the Install Office Outlook Add-in task. Save the build definition using the Save button.
Let the build definition run on the current source by clicking on the Queue new build… button. Once a build agent has received the build request, you’ll be able to follow the process in the console and build tree to the left. By the end of the build process, the installation of the manifest file occurs. If the installation step fails, so does the entire build.
If you browse to your Outlook in the Office 365 tenant, you should now find the Outlook add-in installed. This is great way of streamlining the installation process of an Outlook add-in by integrating it into your build definition. In addition, the extension also includes the abiltiy to uninstall an Outlook add-in. Be sure visit Max Knor’s (the green geek) blog post about the extension: http://blog.knor.net/index.php/2016/08/29/vsts-buildrm-tasks-for-office-js-outlook-add-ins/