Francisunoxx Francisunoxx - 1 year ago 95
Java Question

View.getView() returns null

I'm trying to find my folder or view in my database. Which named Team Documents this folder has some filter option like By Date, By Category. But this returns me a null even the folder already exists.

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


I tried also to fill my
getView()
method like Team Documents. But still returns a null. Any approach to this problem?

UPDATE

According to @Richard Schwartz. No spaces before & after the backslashes. I already get the view by removing the spaces between
getView("Team Documents\\By Date")

Answer Source

While it would have been more helpful if you had included a link to a screenshot of your Domino Designer client's folder list, my best guess is that you have two folders, not one folder with "filter options". Also, my guess is that "Team Documents" is not actually a folder; it's just a prefix on the folder names that makes them appear to be nested in a parent folder.

If that's the case, you would need

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

Or

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

Note: No spaces before & after the backslashes.

If my assumptions above are not correct, then my suggestion would be to assign alias names to the folders in Domino Designer and use the aliases instead of the display names in your code. Frankly, that's always a good practice, because it allows your code to continue working even if you decide to change the display names.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download