使用 Notes.jar 获取给定日期的所有日历条目

发布于 2024-08-05 05:06:44 字数 174 浏览 5 评论 0原文

我正在编写一个简单的 Java 代码来提取给定日期的所有日历条目。我知道可以使用 Domingo,但我只想使用 Notes.jar 来实现此目的。我可以根据给定的凭据创建会话并获取日历对象。我希望提取当前正在运行的 Notes 会话,并使用该会话对象打开邮件文件中的日历视图并开始使用它。但我无法让它工作。有人对此有任何想法或链接吗?

I am working on a simple Java code to extract all calendar entries for a given date. I know it's possible using Domingo but I would like to use only Notes.jar for this purpose. It is possible for me to create a session based on a given credentials and get the calendar object. I am looking to extract the current running Notes session and use that session object to open the calendar view in the mail file and start playing with it. But I am not able to get it working. Anybody have any idea or links on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

作业与我同在 2024-08-12 05:06:44

好吧,我已经完成了默认的笔记 API,下面是代码。

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(); 
         }  

我看到的唯一缺点是,每当提取会话时,注释都会弹出一个密码对话框。到目前为止,在我的搜索中,我还没有找到解决方案。我猜显然是 LN 的安全安排。

Well I have done with the default notes API and here's 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 see is that, whenever the session is extracte, notes pops up a password dialog box. In my searches so far I have not seen a solution for that. Apparently a security arrangement in LN i guess.

佞臣 2024-08-12 05:06:44

仅通过谷歌搜索,我就找到了这篇文章。他们为 Notes 创建了一个 Eclispe 插件。获取员工生日的示例代码也在那里(我猜日历以类似的方式工作):

    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++;
    }

编辑:另请参阅此链接 有关 Notes.jar 的一些文档。

Just by googling I have found this article. They create an Eclispe plugin there for Notes. And the example code for getting employee brithdays is also there (I guess 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 look at this link for some documentation on Notes.jar.

情域 2024-08-12 05:06:44

您可以使用 NotesFactory.createSession() 方法来获取当前会话的句柄。 Notes 将自动共享当前客户端会话。如果此方法失败,则您的基本配置可能有问题。请确保:

  • 您已在运行 Java 应用程序的计算机上完全安装了 Notes 客户端,并确保存在有效的 Notes ID 文件。 (例如,确保您可以成功打开本机上的 Notes 客户端)。
  • 另外,请确保 nnotes.dll 文件可以在您的计算机路径上访问(不同于 Java CLASSPATH)。
  • 并且,确认 Notes.ini 文件也在计算机的 PATH 上。

The NotesFactory.createSession() method is what you can use to get a handle to the current session. Notes will automatically share the current client session. If this method is failing, there may be something wrong with your basic configuration. Be sure that:

  • You have the Notes Client fully installed on the machine running the Java app, and be sure there is a valid Notes ID file. (For example, be sure you can open the Notes client on this machine successfully).
  • Also, be sure that the the nnotes.dll file is accessible on your machine's path (different than the Java CLASSPATH).
  • And, confirm that the Notes.ini file is also on the machine's PATH.
终遇你 2024-08-12 05:06:44

@vikramjb,尝试执行 NotesFactory.createSession((String) null, (String) null, password);防止每次在会话中执行需要安全的操作时都会弹出注释密码提示。

从这里发现了这一点: http://lekkimworld.com/2006/07/10 /java_in_notes_domino_explained_domino_session_tester.html

@vikramjb, try doing NotesFactory.createSession((String) null, (String) null, password); to prevent the notes password popup from prompting you each time you do something with the session that needs security.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文