Francisunoxx Francisunoxx - 1 year ago 78
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;

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

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

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

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


catch(NotesException e)

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


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"); 


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