Get all calendar entries for a given date using Notes.jar

I am working on simple Java code to retrieve all calendar entries for a given date. I know this is possible with Domingo, but I would like to use only Notes.jar for this purpose. It is possible to create a session based on the given credentials and get a calendar object. I want to retrieve the current Notes session and use that session object to open the calendar view in a zip file and start playing around with it. But I cannot get it to work. Anyone have an idea or links to this?

+2


source to share


4 answers


Well I did with the default notes API and here is the code.

NotesAPITest nat = new NotesAPITest();
        NotesThread.sinitThread();

        Session sess1 = NotesFactory.createSession();
        System.out.println(sess1.getUserName());
        Database database = sess1.getDatabase("", "mailfile");
        View calendarView = database.getView("($Calendar)");
        DateTime dt = sess1.createDateTime("today");
        ViewEntryCollection vec = calendarView.getAllEntriesByKey(dt, true);

        ViewEntry entry = vec.getFirstEntry();
         while (entry != null) 
         {

           Document caldoc = entry.getDocument();

           System.out.println("Subject: " + caldoc.getItemValueString("Subject"));
           System.out.println("Chair Person: " + caldoc.getItemValueString("Chair"));
           System.out.println("Start Time: " + nat.getStartEndTimes(caldoc, "StartDateTime") );
           System.out.println("Start Time: " + nat.getStartEndTimes(caldoc, "EndDateTime") );
           System.out.println("Required: " + caldoc.getItemValueString("RequiredAttendees"));
           entry = vec.getNextEntry(); 
         }  

      



The only drawback I can see is that whenever a session is an extract, the notes pop up with a password dialog. In my searches so far, I have not seen a solution for this. Apparently the security convention in LN I think.

+3


source


Just by googling I found this article . They create a Notes plugin for Eclispe. And there is a sample code for getting brithdays to work as well (I think Calendar works in a similar way):

    s = NotesFactory.createSession();

    // Get the local address book
    Database nab = s.getDatabase("",s.getAddressBooks().elementAt(0).toString());
    if (nab.isOpen() == false) nab.open();  

    // Get the Birthdays & Anniversaries view           
    View baview = nab.getView("BA");
    ViewEntryCollection eba = baview.getAllEntries();
    ViewEntry entry = eba.getFirstEntry();

    list = new String[eba.getCount()];
    int count = 0;

    while (entry != null) {

        Vector vals = entry.getColumnValues();                           
        list[count]= vals.elementAt(1).toString() + " " + vals.elementAt(2).toString();                         
        entry = eba.getNextEntry();
        count++;
    }

      



EDIT . Also have a look at this link for some Notes.jar documentation.

+2


source


The NotesFactory.createSession () method is what you can use to get a handle to the current session. Notes are automatically exchanged by the current client session. If this method doesn't work, there might be something wrong with your base configuration. Make sure that:

  • You have a Notes client fully installed on a computer that is running a Java application and make sure there is a valid Notes ID file. (For example, make sure you can successfully open the Notes client on this computer).
  • Also make sure the nnotes.dll file is available on your machine path (different from Java CLASSPATH).
  • And confirm that the Notes.ini file is also on the machine's PATH.
+2


source


@vikramjb, try doing NotesFactory.createSession ((String) null, (String) null, password); to prevent Notes from popping up when you do something with a session that needs security.

Found out about it here: http://lekkimworld.com/2006/07/10/java_in_notes_domino_explained_domino_session_tester.html

+1


source







All Articles