Let NAV PLAY! (Media Play… of course)

In this blog you will find the source code in order to implement a client add-in based project with Windows Media Player. You would have a wide range of possibilities to use this simple add-in and enlarge this project on your own.

If you want to know more about client add-ins you can refer to MSDN link:

Extending the RoleTailored Client Using Control Add-ins in Microsoft Dynamics 2009 SP1

Step by step creation of the NavMP (NAV Media Player) add-in:

 (always remember the 'DodgeBall' rules: Develop, Sign, Place, Register, and Develop)

  1. DEVELOP your add-in (in Visual Studio)
  2. Strong SIGN and Build
  3. PLACE DLLs into Add-ins folder
  4. REGISTER the add-in in Table 2000000069, Client Add-in
  5. DEVELOP your C\AL code (in Object Designer)

My ingredients:

  • Visual Studio 2010 Professional
  • Windows 7 Enterprise
  • Windows Media player 12

DodgeBall rule 1: DEVELOP your add-In (in Visual Studio)

A. Create a New Class project

  1. Open Visual Studio (in this example I am using Visual Studio 2010)
  2. Create a New Project (CTRL+SHIFT+N) with these parameters:
    • Visual C# - Windows
    • Class library
    • .NET Framework 3.5
    • Name: NavMP
    • Location: C:\TMP (or whatever location you like)
    • Solution Name: NavMP
    • Create directory for solution


B. Create a Strong Name Key (SNK)

  1. Go to Project > Properties (NavMP Properties...)
  2. From the Project Properties form go to the Signing tab
  3. Tick the Sign the assembly option
  4. Create a New SNK (e.g. NavMP.snk)


C. Add a Windows Form to the class project and modify its properties

  1. In the main menu click on "Project" > "Add New Item" (Ctrl + Shift + A)
  2. Select "Windows Form"
  3. Click "Add"
  4. In this way, Visual Studio has added a brand new Windows Form to your project and inherit all the necessary references.


  • The brand new Form should be added to your project. And you just simply need to change the Form properties as reported below:
Property Value
AutoScaleMode None
Autosize True
FormBorderStyle None
Locked True
MaximizeBox False
MinimizeBox False
Size 212;207
Text NAV Media Player


D. Add a Media Player object  to the class project and modify its properties

  1. Normally, a Media Player object is not present as an item in the Toolbox. In order to add it you need to have Media Player installed in your machine. Then, you can just follow the next steps or simply refer to this useful How To video: http://msdn.microsoft.com/en-us/vcsharp/bb798025.aspx
  2. Go to the Toolbox and scroll down to the last available space ("General" group)
  3. Click on General > Right-click in the blank area > Select "Choose Items"

  • In the "Choose Toolbox Items" form > Select tab "COM Components" > check on "Windows Media Player" and click OK

  • Now the Windows Media Player item should be added to your toolbox


  • Select the Windows Media Player item and drop it into the Form created before

  • Right click on the Windows Media Player control added and click on "Properties"
  • Change the Windows Media Player properties as reported in the screens below and click OK

  • Change the Windows Media Player control item properties added to the Form
Property Value
(Name) NAVMediaPlayer
Anchor Top, Bottom, Left, Right
Ctlenabled True
enableContextMenu True
fullScren False
Location 0;0
Locked True
Margin 2;2;2;2
Size 287;256
stretchToFit True
uiMode full
windowlessVideo False


If you want to know more about the player object visit http://msdn.microsoft.com/en-us/library/dd564034(v=VS.85).aspx.

E. Add remaining References to the project

  1. In the Solution Explorer window select "Reference", right-click "Add Reference"
  2. Add a reference to Microsoft.Dynamics.Framework.UI.Extensibility

F. Develop (add code to) your NavMP project

  1. Locate your Form1.cs file in the Solution Explorer
  2. Right-click > View Designer (Shift+F7)

  • Replace the C# code with the one written below (or copy that from the image)


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;


namespace NavMP


    public partial class Form1 : Form


        public Form1()




        private void NavMediaPlayer_Enter(object sender, EventArgs e)


            string MoviePath = @"C:\TMP\Presentation.avi";

            NavMediaPlayer.settings.autoStart = false;

            NavMediaPlayer.URL = MoviePath;




  • Now, you need to add some code also in the Class
  • Right-click on the form and select "View Designer" (Ctrl + F7)
  • Select the Media Player control
  • Right-click on it and select "View Code" (F7)

  • Replace the C# code with the one written below (or copy that from the image)

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Linq;

using System.Text;

using Microsoft.Dynamics.Framework.UI.Extensibility;

using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

using System.Windows.Forms;

using System.Drawing;


namespace NavMP


    // WinFormsControlAddInBase


    [Description("Let this Add-in Media Play")]


    public class TestMPClass : StringControlAddInBase


        // Form

        protected override Control CreateControl()


            Form1 MPForm = new Form1();

            MPForm.TopLevel = false;

            MPForm.Visible = true;

            return MPForm;




DodgeBall rule 2 : Strong SIGN and build

  1. Now it is all set up, you are ready to build your client add-in. In the main menu, go to "Build" > "Build NavMP". (This is automatically strong signed as per rule 1 point B.)

DodgeBall rule 3 : PLACE DLLs into Add-In folder

  1. Locate/copy/paste NavMP.dll, AxInterop.WMPLib.dll and Interop.WMPLib.dll (should be in your \NavMP\NavMP\bin\Debug folder) in the Add-ins folder of a machine where the RoleTailored client has been installed (typically C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins).

DodgeBall rule 4 : REGISTER the Add-in in Table 2000000069 Client Add-in

  1. Launch the Visual Studio Command Prompt (VSCP)
  2. In the VSCP:

Sn -T "C:\TMP\NavMP\NavMP\bin\Debug\NavMP.dll"

 dfcb4863cf7c4cb0 is the PKT (Public Key Token) needed to register the AddIn into NAV.

(You will probably have another value, this is just an example)

  • Open Classic Client
  • Open Object Designer (SHIFT+F12)
  • Select Table object (ALT+B)
  • Run Table 2000000069 Client Add-in
  • Insert a new line with these values:
  • Field Value
    Control Add-in Name Cronus.DynamicsNAV.NMediaPlayer
    Public Key Token dfcb4863cf7c4cb0 (this is an example)
    Description Let this Add-in Media Play

DodgeBall rule 5 : DEVELOP your C/AL code

  1. Copy/paste the Txt format code written below in a new Notepad object or download the Txt file from the bottom of this blog

OBJECT Page 50100 Nav Media Player







    Version List=;










    { 1101100000;0;Container;

                ContainerType=ContentArea }


    { 1101100001;1;Field  ;

                ControlAddIn=[Cronus.DynamicsNAV.NMediaPlayer;PublicKeyToken=dfcb4863cf7c4cb0] }





      Text10000000@1101100000 : TextConst 'ENU=LET NAV Play !';



      WARNING ----------------------------------------------------------------------------







  • Import the txt object
  • Compile the txt object newly created (Page 50100 Nav Media Player)
  • IMPORTANT: Create an AVI file called Presentation.avi in your C:\Tmp directory (create the directory as well, where needed)
  • Run Page 50100 Nav Media Player
  • Enjoy it!!!

This simple client add-in project may be used in, e.g.

  • Customer general presentations
  • Stream MP3 files
  • ... and many more

This simple client add-in project may be enlarged, e.g.

  • It could be possible to enlarge the project and bound this to a field in order to play whatever file in a share (no hardcoded c:\tmp\Presentation.avi)
  • ... and many more

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

Duilio Tacconi (dtacconi)

Microsoft Dynamics Italy

Microsoft Customer Service and Support (CSS) EMEA


Comments (2)

  1. waldo says:

    Nice example! 🙂

  2. Shiplu says:

    It is not clear to me..

    1.on Right clicking Form -> View designer (not opening the form1.cs) it showing form1.designer.cs.

    2. for the second code where should i add it ??????

Skip to main content