View.getView() returns 空

View.getView() returns null

我正在尝试在我的数据库中查找我的文件夹或视图。这个名为 Team Documents 的文件夹有一些过滤选项,例如 By DateBy Category。但是这个returns即使文件夹已经存在我也是空的。

String dbServer = "d23dbm95/23/A/IBM", dbFileName = "dbom\farizan\stsklb1.nsf";


public void runNotes()
{
    Session session = null;
    Database db = null;
    View view = null;
    Document doc = null;

    try
    {
        NotesThread.sinitThread();
        session = NotesFactory.createSession();
        System.out.println("User = " + session.getUserName());
        db = session.getDatabase(dbServer, dbFileName);

        if(db.isOpen())
        {
            System.out.println("Title "+db.getTitle());

            view = db.getView("Team Documents \ By Date");


            if(view == null)
            {
                System.out.println("still null");
            }

        }

    }
    catch(NotesException e)
    {
        e.printStackTrace();
    }
}

我也尝试填写我的 getView() 方法,例如 Team Documents。但仍然 returns 为空。有解决这个问题的方法吗?

虽然如果您在 Domino Designer 客户端文件夹列表的屏幕截图中包含 link 会更有帮助,但我最好的猜测是您有两个文件夹,而不是一个带有 [=26] 的文件夹=].另外,我的猜测是 "Team Documents" 实际上不是一个文件夹;它只是文件夹名称的前缀,使它们 看起来 嵌套在父文件夹中。

如果是这样,您需要

iew = db.getView("Team Documents\By Category"); 

iew = db.getView("Team Documents\By Date"); 

注意:反斜杠前后没有空格。

如果我的上述假设不正确,那么我的建议是为 Domino Designer 中的文件夹分配别名,并在代码中使用别名而不是显示名称。坦率地说,这 始终 是一个很好的做法,因为它允许您的代码继续工作,即使您决定更改显示名称。