Using NotesUI* Classes in C# with COM

The NotesUI* Classes are not accesible in Visual Studio via the References-Dialog. Also in the DesignerHelp it is said, that you can not use the UI-Classes.


But there is a very simple Solution in C# by using the dynamic – Keyword and the .NET System.Activator Class.


The following Code-Sample connects to an running Notes Client and performs some actions:

class Program
        static void Main(string[] args)
            dynamic session = Activator.CreateInstance(Type.GetTypeFromProgID("Notes.NotesSession"));
            dynamic uiws = Activator.CreateInstance(Type.GetTypeFromProgID("Notes.NotesUIWorkspace"));
            dynamic uidb = uiws.CurrentDatabase;
            dynamic dbDir = session.GetDbDirectory("NTSDEV2008");

            Console.WriteLine("Benutzer : {0}", session.UserName);
            Console.WriteLine("Datenbank: {0}", uidb.Database.FilePath);

            uiws.OpenDatabase("NTSDEV2008", "names.nsf");




I found no current usecase for this at the moment, but good to know that this is possible …