Click here to Skip to main content
13,253,118 members (51,647 online)
Click here to Skip to main content
Add your own
alternative version


77 bookmarked
Posted 23 Apr 2007

Lotus Notes Integration with Microsoft .NET Platform (C#)

, 23 Apr 2007
Rate this:
Please Sign up or sign in to vote.
This article explains how to use .NET and Lotus Notes Interop to integrate Lotus Notes capabilites into applications
Sample Image - maximum width is 600 pixels


The article describes with the help of a Windows application how Lotus Notes can be integrated with .NET using Lotus Notes Interop.


The Lotus Notes .NET Interop provides a way of communication between the Microsoft .NET platform and Lotus Notes client and dominos server. It supports access to Lotus Notes documents and views, and allows you to write various applications, for example, Web form, Windows form, and console applications within Microsoft Visual Studio .NET. You can use all Common Language Runtime (CLR) programming languages such as Visual Basic .NET, C#, or Managed C++.

At runtime, the Lotus Notes interop fetches the data as requested using the Interop classes, i.e. NotesViewEntryCollection, NotesViewEntry and NotesDocument. These classes for Lotus Notes clients provides .NET developers with a familiar way to use Lotus Notes functionality. Using the code, developers can access Lotus Notes documents and can integrate Lotus Notes capabilities to any external applications.

This article assumes that you have basic understanding of Lotus Notes.


  • Windows 2000 or Windows XP 
  • Microsoft Visual Studio .NET 
  • Lotus Notes client installed or Interop.Domino.dll
  • Basic understanding of Lotus Notes.

Create a C# Application using Lotus Notes Connector

The example demonstrates how to fetch information regarding 'Contacts' from user contacts and central contacts database.


  1. Open Microsoft Visual Studio .NET.
  2. Create a new C# Windows application project:
    Choose New --> New Project ?--> Visual C# Projects ?--> Windows Application.
    You can also create a project in any other common programming language.
  3. Add controls to your form

In our sample code, we have added few textboxes for configuration of Lotus Notes client, a Button to Start Searching contacts and a Listbox control to list out the results.

  1. In the Solution Explorer, right-click on your project references. 
  2. Choose Add --> Add Reference.
  3. Select Browse button under .NET --> Select the Interop.Domino.dll. (This DLL can be found in the sample code.)
  4. We are ready to go and integrate Lotus Notes capabilities into our application.
  5. First we need to create a session for communicating with Lotus Notes client and dominos server
  6. //
    Code snippet for establishing a Lotus notes session
    //Lotus Notes Object Creation
    _lotesNotesSession = new Domino.NotesSessionClass();
    //Initializing Lotus Notes Session
    _lotesNotesSession.Initialize( NotesPassword );
    //Creating Lotus Notes DataBase Object
    _localDatabase = _lotesNotesSession.GetDatabase( "", "names.nsf", false );
    //creating Lotus Notes Contact View
    _contactsView = _localDatabase.GetView( "Contacts" );
    if( FetchServerData )
    { _lotusNotesServerSession = new Domino.NotesSessionClass();
      _lotusNotesServerSession.Initialize( NotesPassword );
      //Creating Lotus Notes DataBase Object
      _serverDatabase = _lotusNotesServerSession.GetDatabase
    		( DominoServerName, "names.nsf", false );
      //creating Lotus Notes Contact View
      _peopleView = _serverDatabase.GetView( "$People" ); }
    }//end if(FetchServerData )  

    (Please take note here that while establishing a session, we only provide userpassword and servername, we don't provide username as the last user login into Lotus client is always taken as the userId.)

    </li />
  7. Now after establishing a session, we need to iterate through various views to fetch the desired data:
  8. //
    //Code snippet for iterating through the views and fetching data
        NotesViewEntryCollection  notesViewCollection =LotusNotesView.AllEntries;
        for( int rowCount = 1; rowCount <= notesViewCollection.Count; rowCount++ )
            //Get the nth entry of the selected view according to the iteration.
            NotesViewEntry viewEntry = notesViewCollection.GetNthEntry( rowCount );
            //Get the first document of particular entry.
            NotesDocument document =  viewEntry.Document;
            object documentItems = document.Items;
            Array itemArray1 = (System.Array)documentItems;
            for( int itemCount=0 ; itemCount< itemArray1.Length; itemCount++ )
                NotesItem notesItem = 
    			(Domino.NotesItem)itemArray1.GetValue( itemCount );
                //compare field value with specific value entered by user
                if( notesItem.Text !=null )
                    if( (notesItem.Text.ToUpper()).StartsWith( fieldValue ))
                        Contact contact = new Contact();
                        for( int icount=0 ; icount< itemArray1.Length; icount++ )
                            NotesItem searchedNotesItem =
    			(Domino.NotesItem)itemArray1.GetValue( icount );
                            string FieldName = searchedNotesItem.Name.ToString();
                            //For FirstName
                            if( searchedNotesItem.Name == "FirstName" )
                                contact.FirstName= searchedNotesItem.Text;
                            //For LastName
                            if( searchedNotesItem.Name == "LastName" )
                                contact.LastName = searchedNotesItem.Text;
                            //For Office Phone Number
                            if( searchedNotesItem.Name == "OfficePhoneNumber" )
                                contact.OfficePhoneNumber = searchedNotesItem.Text;
                            if( searchedNotesItem.Name  == "InternetAddress" )
                                contact.EmailId = searchedNotesItem.Text;
                        }//end for
                        contactsList.Add( contact );
                    }//End if

    If you see in the above code snippet NotesViewEntry, NotesDocument, NotesItem classes are used to create the objects for Lotus Notes driver data access. So the code snippet and the sample application demonstrates how easily one can integrate Lotus Notes accessing capabilities into an application.

    </li />

How to Pop Open a Contact in Lotus Notes

//Code snippet for popping open a document/contact in lotus notes client
//ContactId is the Main thing :
//this is the universaldocumentID which uniquely identifies this
//if the contacts is on the server

if( IsServerData )
{    //local data

	string lotusNotesPath = ReadRegistry();
	if( lotusNotesPath!="" )
		lotusNotesPath = lotusNotesPath+"notes";
		System.Diagnostics.Process process =
		new System.Diagnostics.Process();
		System.Diagnostics.Process.Start( lotusNotesPath,notesUrl );
		System.Threading.Thread.Sleep( 500 );


  • 23rd April, 2007: This is the first draft of the application.
    I will try and update this to further integrate with other Lotus Notes document types.

About Aditya Gupta

Sample Image - maximum width is 600 pixels

I am currently working in an outsourced software product development company, PROTEANS SOFTWARE SOLUTIONS LTD.( as a Technical Leader. I have around 6 years of experience in the software industry, mainly telecom, computer telephony integration. I have experience in VC++, MFC and in Microsoft .NET technologies(C#).

About Proteans Software Solutions

Proteans is an outsourcing company focusing on software product development and business application development on Microsoft Technology Platform. Proteans partners with Independent Software Vendors (ISVs), System Integrators and IT teams of businesses to develop software products. Our technology focus and significant experience in software product development - designing, building, and releasing world-class, robust and scalable software products help us to reduce time-to-market, cut costs, reduce business risk and improve overall business results for our customers. Proteans expertises in development using Microsoft .NET technologies.


Special thanks to Pankaj Pahuja ( for his inputs and guidance on Lotus Notes client and how to get going with Lotus Interop.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Aditya P Gupta
Web Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionAwesome Pin
HarryDelmas21-Nov-16 20:45
memberHarryDelmas21-Nov-16 20:45 
BugERROR "Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Pin
ajstadlin10-Feb-16 4:47
memberajstadlin10-Feb-16 4:47 
GeneralRe: ERROR "Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Pin
im_chc6-Mar-16 22:25
memberim_chc6-Mar-16 22:25 
QuestionNotes Crashing Pin
Michielc27-Aug-15 23:02
professionalMichielc27-Aug-15 23:02 
QuestionConnecting to LotusNotes server using username and password Pin
Amlan Sengupta9-Feb-15 20:37
memberAmlan Sengupta9-Feb-15 20:37 
QuestionPERFECT! Pin
Member 1054474014-May-14 1:41
memberMember 1054474014-May-14 1:41 
QuestionUsing Interop.Domino.dll without any lotus notes client. Pin
Member 986469922-Jan-14 1:03
memberMember 986469922-Jan-14 1:03 
GeneralMy vote of 3 Pin
Member 1034384417-Oct-13 23:24
memberMember 1034384417-Oct-13 23:24 
QuestionDownload Specific Attachments from Lotus Notes Pin
YuvrajDhamdhere3-Jun-13 3:15
memberYuvrajDhamdhere3-Jun-13 3:15 
QuestionHow to read mails from NotesDatabase object Pin
darshanjbhatt22-Apr-13 3:01
memberdarshanjbhatt22-Apr-13 3:01 
AnswerRe: How to read mails from NotesDatabase object Pin
erikfranz28-Jun-14 9:52
membererikfranz28-Jun-14 9:52 
QuestionUsing Interop.Domino.dll without Lotus client installed Pin
antipirat8-Oct-12 2:17
memberantipirat8-Oct-12 2:17 
AnswerRe: Using Interop.Domino.dll without Lotus client installed Pin
darshanjbhatt8-May-13 0:46
memberdarshanjbhatt8-May-13 0:46 
GeneralRe: Using Interop.Domino.dll without Lotus client installed Pin
mreyeros23-Aug-13 9:50
membermreyeros23-Aug-13 9:50 
GeneralRe: Using Interop.Domino.dll without Lotus client installed Pin
Member 1099293020-Nov-14 3:00
memberMember 1099293020-Nov-14 3:00 
GeneralRe: Using Interop.Domino.dll without Lotus client installed Pin
Member 986469922-Jan-14 1:10
memberMember 986469922-Jan-14 1:10 
QuestionView Name for To Do List Pin
Member 94680023-Oct-12 20:24
memberMember 94680023-Oct-12 20:24 
QuestionSMS from Lotus Notes Pin
WilsonLast14-May-12 20:56
memberWilsonLast14-May-12 20:56 
QuestionHow to test Lotus Notes Integration with Microsoft .NET Platform (C#)? Pin
sawasthi28-Mar-12 23:43
membersawasthi28-Mar-12 23:43 
QuestionHow can i read Lotus Notes Database Items with .Net (C#) without installing Lotus Notes on my System ? Pin
TRON_VS_NEO19-Dec-11 12:43
memberTRON_VS_NEO19-Dec-11 12:43 
QuestionPerformance Issue : Please Help Pin
Bryan Ruddy20-Oct-11 6:23
memberBryan Ruddy20-Oct-11 6:23 
QuestionAccessing Groups from Lotus Notes using Domino.dll and C#. Pin
Preeeti0824-Oct-09 1:28
memberPreeeti0824-Oct-09 1:28 

I am trying to access Groups as follows.

_groupView = _localDatabase.GetView( "Groups" );

But getting null vaues even when my "names.nsf" contains Groups.

GeneralTrouble wih version of Lotus Notes Pin
phenix_28-Aug-09 2:51
memberphenix_28-Aug-09 2:51 
GeneralGetting COM Error [modified] Pin
SuleymanNalci27-Aug-09 5:38
memberSuleymanNalci27-Aug-09 5:38 
GeneralLotusnotes documents migration issue Pin
samtech599-Jun-09 11:18
membersamtech599-Jun-09 11:18 
Questionreschedule a meeting Pin
moali7216-Mar-09 21:58
membermoali7216-Mar-09 21:58 
QuestionLotus Notes Pin
showri raju3-Mar-09 2:53
membershowri raju3-Mar-09 2:53 
GeneralLotus notes integration Pin
beetools4-Feb-09 0:52
memberbeetools4-Feb-09 0:52 
GeneralThanks for the example code Pin
Ted Takacs23-Dec-08 4:46
memberTed Takacs23-Dec-08 4:46 And Lotus notes ( Calender ) Pin
murad198513-Dec-08 2:24
membermurad198513-Dec-08 2:24 
QuestionLotus Notes must be open? Pin
GMazarakis4-Dec-08 7:40
memberGMazarakis4-Dec-08 7:40 
Generaladd appointments in Lotus note 8 Pin
dapangf113-Nov-08 7:01
memberdapangf113-Nov-08 7:01 
GeneralRepeating Meetings Pin
JimSalabimForFaen25-Aug-08 2:05
memberJimSalabimForFaen25-Aug-08 2:05 
GeneralCan't Instantiate NotesSession Pin
MiloZA13-Aug-08 0:29
memberMiloZA13-Aug-08 0:29 
GeneralSEHException Thrown Pin
Jasdeepkg11-Aug-08 4:10
memberJasdeepkg11-Aug-08 4:10 
GeneralRead Lotus Notes ToDo Items Pin
C# Friendly28-Jul-08 10:00
memberC# Friendly28-Jul-08 10:00 
GeneralRe: Read Lotus Notes ToDo Items Pin
C# Friendly28-Jul-08 11:36
memberC# Friendly28-Jul-08 11:36 
GeneralRe: Read Lotus Notes ToDo Items Pin
tsilb17-Nov-08 9:45
membertsilb17-Nov-08 9:45 
GeneralInterop.Domino.dll Pin
Moustafar17-Jun-08 7:38
memberMoustafar17-Jun-08 7:38 
GeneralRe: Interop.Domino.dll Pin
Jack7817-Feb-09 1:36
memberJack7817-Feb-09 1:36 
QuestionProcess <path_to_exe_file> has terminated abnormally : Howto clean up session to Domino ?</path_to_exe_file> Pin
peterve18-Apr-08 22:52
memberpeterve18-Apr-08 22:52 
AnswerRe: Process has terminated abnormally : Howto clean up session to Domino ? Pin
Leon v Wyk30-Jun-09 23:41
memberLeon v Wyk30-Jun-09 23:41 
AnswerSystem.Runtime.InteropServices.Marshal.ReleaseComObject() Pin
RenniePet14-Jul-10 16:31
memberRenniePet14-Jul-10 16:31 
QuestionWrapping into ADO.NET? Pin
Marakai17-Mar-08 14:29
memberMarakai17-Mar-08 14:29 
Questionhow to send Notification emails in lotus notes Server in dot net 2.0 by using C#. Pin
mrityyunjay20-Dec-07 20:45
membermrityyunjay20-Dec-07 20:45 
Questionhow to send Notification emails using lotus notes Server in dot net 2.0 by using C#. Pin
mrityyunjay20-Dec-07 20:44
membermrityyunjay20-Dec-07 20:44 
GeneralADDIN for Lotus Notes similar to Outllook using DotNet Pin
Govardhana Reddy16-Nov-07 8:31
memberGovardhana Reddy16-Nov-07 8:31 
GeneralCannot register Domino.dll [modified] Pin
rayudu14-Nov-07 9:59
memberrayudu14-Nov-07 9:59 
QuestionHow to send emails using the Interop.Domino Pin
suhayb10-Oct-07 23:02
membersuhayb10-Oct-07 23:02 Pin
grijalba10-Oct-07 5:37
membergrijalba10-Oct-07 5:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 23 Apr 2007
Article Copyright 2007 by Aditya P Gupta
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid