---
title: "Plugin Capability of DataMigrate Pro: “getprinter” Example"
id: "997938"
type: "post"
slug: "plugin-capability-datamigrate-pro-getprinter"
published_at: "2025-09-12T13:11:20+00:00"
modified_at: "2026-09-02T06:06:55+00:00"
url: "https://ioi.gmbh/en/2025/09/12/plugin-capability-datamigrate-pro-getprinter/"
markdown_url: "https://ioi.gmbh/en/2025/09/12/plugin-capability-datamigrate-pro-getprinter.md"
excerpt: "This document describes a first sample implementation of a plugin in the DataMigratePro system. 1. Introduction The plugin architecture of DataMigratePro lets you integrate external functions into the system as modules. The aim is extensibility without changing the core code...."
taxonomy_category:
  - "DataMigrate Pro"
  - "Support &amp; Documentation"
---

Contents

- [1. Introduction](#1-introduction)
- [2. Development of the plugin](#2-development-of-the-plugin)
- [3. Business Central Integration](#3-business-central-integration)
- [4. Sample output](#4-sample-output)
- [5. Conclusion](#5-conclusion)

This document describes a first sample implementation of a plugin in the DataMigratePro system.

## 1. Introduction

With the plugin architecture of DataMigratePro, external functions can be integrated into the system in a modular way. The goal is extensibility without changing the core code.

## 2. Development of the plugin

The following example implements the `IRelayPlugin` interface. The `getprinter` action returns a list of the locally installed printers:

```
using System;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Drawing.Printing;
using DataMigratePro.Plugins;

namespace GetPrinterPlugin
{
    public class GetPrinterPlugin : IRelayPlugin
    {
        public string ActionName => "getprinter";

        public async Task<string> ExecuteAsync(string base64Data)
        {
            await Task.Yield(); // simulate async
            string decodedInput = Encoding.UTF8.GetString(Convert.FromBase64String(base64Data));

            var printers = new List<string>();
            foreach (string printer in PrinterSettings.InstalledPrinters)
            {
                printers.Add(printer);
            }

            var result = new
            {
                action = ActionName,
                input = decodedInput,
                printers = printers
            };

            return System.Text.Json.JsonSerializer.Serialize(result, new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
        }
    }
}
```

**🔧 Note: the plugin DLL and the `DataMigratePro.Plugins.dll` must be copied into the `plugins` subdirectory.**

## 3. Business Central Integration

An AL page is provided for controlling the plugin; it handles the call and displays the result.

```
page 50100 "Relay Result Viewer"
{
    PageType = Card;
    Caption = 'Relay Result Viewer';
    ApplicationArea = All;
    UsageCategory = Administration;

    layout
    {
        area(content)
        {
            field("ActionText"; ActionText) { ApplicationArea = All; }
            field("JSON (Raw)"; RawJsonText) { ApplicationArea = All; MultiLine = true; }
            field("Response"; ResultText) { ApplicationArea = All; Editable = false; MultiLine = true; }
            field("Info"; InfoText) { ApplicationArea = All; Editable = false; Style = Attention; StyleExpr = true; }
        }
    }

    actions
    {
        area(Processing)
        {
            group(Action)
            {
                action(SendToRelay)
                {
                    Caption = 'Send to Azure Relay';
                    Image = ExecuteBatch;
                    ApplicationArea = All;
                    Promoted = true;
                    PromotedCategory = Process;
                    PromotedIsBig = true;

                    trigger OnAction()
                    var
                        Sender: Codeunit "Azure Relay Sender IOI";
                        FullJson: Text;
                        EncodedMessage: Text;
                    begin
                        Base64Data := ToBase64(RawJsonText);
                        FullJson := '{"action":"' + ActionText + '","data":"' + Base64Data + '"}';
                        EncodedMessage := ToBase64(FullJson);
                        ResultText := Sender.SendMessage(EncodedMessage);
                    end;
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        ActionText := 'getprinter';
        RawJsonText := '{}';
        InfoText :=
            'This tool sends actions to Azure Relay. ' +
            'The data will be base64 encoded and wrapped into a JSON structure like: ' +
            '{"action":"...","data":"..."}, then encoded again before sending.';
    end;

    var
        ActionText: Text;
        RawJsonText: Text;
        Base64Data: Text;
        ResultText: Text;
        InfoText: Text;

    local procedure ToBase64(InputText: Text): Text
    var
        TempBlob: Codeunit "Temp Blob";
        Base64Convert: Codeunit "Base64 Convert";
        OutStr: OutStream;
        InStr: InStream;
    begin
        TempBlob.CreateOutStream(OutStr, TextEncoding::UTF8);
        OutStr.WriteText(InputText);
        TempBlob.CreateInStream(InStr, TextEncoding::UTF8);
        exit(Base64Convert.ToBase64(InStr));
    end;
}
```

## 4. Sample output

After successful execution, the result is displayed in the `Response` field of the page:

## 5. Conclusion

This plugin shows how flexibly and modularly DataMigratePro can be extended. This architecture allows new functions to be developed, tested and operated in isolated modules.

About the author

#### Sascha Marquardt

Responsible for the partner programme, the licensing business and commercial project delivery.

Keep reading## More from the IOI blog

[Artificial Intelligence (AI) DataMigrate Pro with AI agents: the MCP server An AI agent may look things up, compare and suggest. It may change or migrate only if you switch that on and… 2. November 2026 · 3 minutes](https://ioi.gmbh/en/2026/11/02/datamigrate-pro-with-ai-agents-mcp-server/)
[DataMigrate Pro What’s new in DataMigrate Pro? Data reconciliation between NAV and Business Central, GDPdU export, evidence for audits and a first look at AI agents. 2. November 2026 · 5 minutes](https://ioi.gmbh/en/2026/11/02/whats-new-in-datamigrate-pro/)
[DataMigrate Pro DataMigrate PRO Synch-Service Setting up and running the service bus listener as a Windows service – from the prerequisites to settings.json 24. October 2025 · 4 minutes](https://ioi.gmbh/en/2025/10/24/datamigrate-pro-synch-service/)

## From reading to action. Book your upgrade check.

In the free upgrade check we analyse your current Navision or NAV version and show you the direct path to Business Central – including effort, sequence and a fixed-price range.

[Book a free Upgrade-Check →](/en/business-central-upgrade-check/)
[Give us a quick call: +49 214 8402 3000](tel:+4921484023000)

✓ Directly from any Navision or NAV version

✓ Live test while the legacy system keeps running

✓ C/AL→AL conversion included

✓ Fixed-price range and timeline afterwards
