Customize the Outlook add-in in Business Central

Customize the Outlook add-in in Business Central

Business Central has also an Outlook add-in so you can use Business Central in your Outlook client (web and desktop app). You can learn how you can implement it here:
Get the Business Central Add-in for Outlook – Business Central | Microsoft Learn

This add-in (not talking about the Document Viewer. Maybe in a later blog post) has the following actions to create new entities in Business Central:

But what if you want to create your own add-in (you cannot extend the excisting one)?

How it works in short

In Outlook you can upload (or via centralized deployment) an add-in. In this add-in you can add some actions.
When a user hits the action is calls the Business Central URL (for example )
In Business Central is will fill the table “Office Add-in Context” with the fields that are recognized (for example subject, e-mail etc). And then through some events it will trigger a codeunit that handles the .

If you want to create your own add-in you will have to do the following:

Create your own codeunit

First you have to create your own codeunit. This codeunit has the source table of “Office Add-in Context”:

After that you have done you have to subscribe to a couple of events:

In the event ‘OnGetExternalHandlerCodeunit’ you must set your own codeunit name so it will take your customized codeunit. This event with through when the user clicks an action in Outlook.

Event ‘CreateDefaultAddins’ will be triggerd when in Business Central you push the action “Reset Default Add-ins”. Then your add-in will be added to the list.
You can also upload you add-in. But in this way every user has the same. The add-in will be handled in the function “SetDefaultManifestText” but how you create your manifest will be in the chapter below.
Your add-in must have a unique GUID!

This will be triggered when you generate the manifest. But again in chapter below I will handle creating the manifest file.

Those are the most important. Then there are some events that you also need to subscribe to:

Then as you can see in the OnRun trigger it calls the function “HandleCommand”. In this function you can handle all your command from the URL that you have triggered:

This command will be also stored in the table “Office Add-in Context”. In this example it Opens the project List:

(also you can apply some filtering. And it will open the Project List in the Outlook add-in.
But you can also create a new record. An example for this is:

And if you want to setup some thing use RecordRef and Variant 😊.

That is all for the codeunit.

Outlook add-in manifest

As said you can create your own manifest and upload it. But also create is through a codeunit. In the event ‘CreateDefaultAddins’ you have the line:
In the function DefaultManifestText() the manifest will be created (an example you can find in codeunit “Intelligent Info Manifest”.
There are some important sections in it:

In the main part you enter the ID, Version and but the URLS in place.
In the FormSettings sectioon you can find the URLS for Items (Mails and Appointments) for read and Edit.

Then you have the ExtensionPoints here you can define whichs actions (or labels) you want to add per ExtensionPoint. Maybe you want some action in one please (for example reading message and not in the appointment. The ExtensionPoints that are used in Business Central are:
– MessageReadCommandSurface
– MessageComposeCommandSurface
– AppointmentOrganizerCommandSurface
– AppointmentAttendeeCommandSurface

All you can find here:
Outlook add-in manifests – Office Add-ins | Microsoft LearnOffice Add-ins manifest reference – Office Add-ins | Microsoft Learn
ExtensionPoint element in the manifest file – Office Add-ins | Microsoft Learn


An example you can find here:
GitHub – Bertverbeek4PS/OutlookAddin

If you want to validate your add-in manifest you can go to this site:
Validate an Office Add-in’s manifest – Office Add-ins | Microsoft Learn

Also if you experienced issues with the outlook add-in launch the debugger in your browser. If you call the action you can see some events thrown there:

In this event you can see all the actions that it calls and inserted into the table “Office Add-in Context”

Below it is mostly the same but then in string:


Leave a Reply

Your email address will not be published. Required fields are marked *