none
extracting lotus notes database

    Question

  • i want to extract lotus notes .nsf

    can you please suggest ....

    By Mr.Erwin post......i got something

     

     

    "It's actually very simple.

    Create a new project in VS.Net 2003/2005. Add a reference to to Domino to it (right click on the References in the Solution Explorer, switch to the 'COM' tab, locate "Lotus Domino Object" and click OK).

    Now in your code add a 'using Domino' statement on top of your class.

    In your method you can now create a new NotesSession object as follows:

     

     NotesSession session = new NotesSession();
    session.Initialize(
    "");
    NotesDatabase db = session.GetDatabase("yourserver""yourdatabase"false);

    etc. etc. etc.

    This does imply though that you have Lotus Notes installed on your computer.

    /Erwin"

     

    I cant able to figure out the code.....can you please help on this


    coolboy
    Monday, September 12, 2011 1:45 PM

Answers

All replies

  • Can anyone suggest how to read lotus notes db???

     

    Many Thanks


    coolboy
    Monday, September 12, 2011 2:05 PM
  • Hello folks....

    I wana read lotus notes database...

    for that i did some coding....Please suggest is this right approach

    Many Thanks

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using Domino;

     

    namespace ConsoleApplication1

    {

        class Program

        {

            static void Main(string[] args)

            {

     

                NotesSession session = new NotesSession();

                Console.WriteLine("Enter password:");

                string sPassword = Console.ReadLine();

                session.Initialize(sPassword);

                NotesDatabase db = session.GetDatabase("vm-domino4", "mts.nsf", true);

     

            }

        }

    }


    coolboy
    Tuesday, September 13, 2011 6:58 AM
  • Seems that ODBC (be aware it is not complete functioning in Net) is your last hope.

    http://www.connectionstrings.com/lotus-notes


    Success
    Cor
    Tuesday, September 13, 2011 7:03 AM
  • Can you please  modify my code for clear understanding to me......

     

    many thanks


    coolboy
    Tuesday, September 13, 2011 7:07 AM
  • When am debuggng this code......I got the notification from lotus notes error what may be the problem??Please suggest 
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Domino;
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Creating the notes session and passing password
                NotesSession session = new NotesSession();
                Console.WriteLine("Enter password:");
                string sPassword = Console.ReadLine();
                session.Initialize(sPassword);
                //Getting the DB instance by passing the servername and path of the mail file.  
                //third param "false" will try to check the DB availability by opening the connection
                //if it cannot open, then it returns null.
                NotesDatabase NotesDb = session.GetDatabase("VM-DOMINO6","C:\\ProgramFiles(x86)\\IBM\\Lotus\\Notes\\Data\\mts.nsf", false);
                //Get the view of the source folder
                NotesView inbox = NotesDb.GetView("($Inbox)");
                //looping through each email/document and looking for the attachments
                //if any attachments found, saving them to the given specified location
                //moving the read mails to the target folder
                NotesDocument docInbox = null;
                int docCnt = inbox.EntryCount;
                for (int currDoc = 0; currDoc < docCnt; currDoc++)
                {
                    docInbox = inbox.GetFirstDocument();
                    object[] items = (object[])docInbox.Items;
                    foreach (NotesItem nItem in items)
                    {
                        if (nItem.Name == "$FILE")
                        {
                            NotesItem file = docInbox.GetFirstItem("$File");
                            string fileName = ((object[])nItem.Values)[0].ToString();
                            NotesEmbeddedObject attachfile = (NotesEmbeddedObject)docInbox.GetAttachment(fileName);
                            if (attachfile != null)
                            {
                                attachfile.ExtractFile("D:\\test\\" + fileName);
                            }
                        }
                    }
                    //docInbox.PutInFolder(targetFolder, true);//"true" creates the folder if it doesn't exists
                    //docInbox.RemoveFromFolder(sourceFolder);
                }
                //releasing resources
                if (session != null)
                    session = null;
                if (NotesDb != null)
                    NotesDb = null;
                if (inbox != null)
                    inbox = null;
                if (docInbox != null)
                    docInbox = null;
            }
        }
    }

    coolboy
    Tuesday, September 13, 2011 8:40 AM
  • Folks can you please help us

     

    Thanks


    coolboy
    Tuesday, September 13, 2011 10:25 AM
  • If you use ODBC than you cannot do it in the way you're using the code.

    See the sample on this page according to the odbcDataAdapter

    http://msdn.microsoft.com/en-us/library/system.data.odbc.odbcdataadapter.aspx

     


    Success
    Cor
    Tuesday, September 13, 2011 10:47 AM
  • Dear Cor 

    Thanks for your reply......

    you mean to say......Do i have to create a ODBC connection??

     

    Please elaborate a bit....

    Thanks

     


    coolboy
    Tuesday, September 13, 2011 10:51 AM
  • I gave you this sample

    public DataSet GetDataSetFromAdapter(
        DataSet dataSet, string connectionString, string queryString)
    {
        using (OdbcConnection connection = 
                   new OdbcConnection(connectionString))
        {
            OdbcDataAdapter adapter = 
                new OdbcDataAdapter(queryString, connection);
    
            // Open the connection and fill the DataSet.
            try
            {
                connection.Open();
                adapter.Fill(dataSet);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // The connection is automatically closed when the
            // code exits the using block.
        }
        return dataSet;
    }
    


    In the link about the dataadapter,

    I gave you the connectionstring in the the link connectionstrings

    If you sent me your keyboard than I can type it maybe in for you.

     


    Success
    Cor
    Tuesday, September 13, 2011 2:08 PM
  • Folks Can you please reply.......................
    coolboy
    Tuesday, September 13, 2011 2:15 PM
  • Folks I able to connect to the domino server. I got the console message as "Connected"......So no need to odbc connection na???

    and can you suggest me (a sample code)for reading the notes documents

    Many thanks

     

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using Domino;

     

    namespace ConsoleApplication4

    {

        class Program

        {

            static void Main(string[] args)

            {

                Domino.NotesSessionClass _lotesNotesSession = new Domino.NotesSessionClass();

                //Initializing Lotus Notes Session

                _lotesNotesSession.Initialize("Sep@2011");

                Domino.NotesDatabase _serverDatabase = _lotesNotesSession.GetDatabase("vm-domino6", "names.nsf", false);

                if (_serverDatabase == null)

                {

                    System.Console.WriteLine("Can not connect to server.");

                }

                else

                {

                    System.Console.WriteLine("Connected");

                }

            }

        }

    }


    coolboy
    Wednesday, September 14, 2011 7:45 AM
  • Hi srinivas_oracle,

    Your require appears to be the same with the one in the following thread, please check it out first:
    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/576fbb6d-aef1-4a4f-b00f-772b6818f96d.

    If your requirement could still not be fulfilled, please post in the official forum of IBM Lotus Notes to get specialized support, then I will move your thread into the Off-Topic Forum shortly.
    Thanks for your understanding.

    Have a nice day,
    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 14, 2011 7:49 AM
    Moderator
  • Can you help us to explain this a little bit more, did you know that this is a Microsoft forum so you get a Micrsoft solution. 

    If you want an IBM solution, than visit the IBM forum

    https://www.ibm.com/developerworks/lotus/community/


    Success
    Cor
    Wednesday, September 14, 2011 9:40 AM
  • Dear  Cor.

     

     I able to connect to the domino server. I got the console message as "Connected"......So no need to odbc connection na???

    and can you suggest me (a sample code)for reading the notes documents

    Many thanks

     


    coolboy
    Wednesday, September 14, 2011 10:17 AM