Get Folder Names From Lotus Domino by C#

I want to get all Folder Names from a NSF by C#. I am using the following code to get connect Notes from C#. Till now it is OK, but failed to collect all folder names from the C#.
Please Help
Domino.NotesSession ns=new Domino.NotesSession();
            ns.Initialize(tbPwd.Text);
            Domino.NotesDbDirectory ndd=ns.GetDbDirectory("DCOKOLS01");
            Domino.NotesDatabase ndb=ns.GetDatabase("DCOKOLS01","mail/Soumen Roy.nsf",false);
            Domino.NotesView nv = ndb.GetView("($All)");

Open in new window

Amitava_MukherjeeAsked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
Views are Folders. Well, not exactly, but you can find the folders in the list of views.

What you need is something like the code below (not tested, and please verify every line).

I don't write C#, but this should give you the clues you need.
Domino.NotesSession ns= new Domino.NotesSession();
ns.Initialize(tbPwd.Text);
Domino.NotesDatabase ndb=ns.GetDatabase("DCOKOLS01","mail/Soumen Roy.nsf",false);
Domino.NotesView allviews[] = ndb.Views;
for(i= 0; ...; i++) {
	if(allviews[i].isFolder) {

		// your code

	}
}

Open in new window

0
 
lucky_jamesCommented:
To reinterpret your question, your views are not coming up.

if yes, check out "Code snippet for iterating through the views and fetching data" in below link:
http://www.codeproject.com/KB/cs/lotusnoteintegrator.aspx

hope it helps.

James
0
 
Amitava_MukherjeeAuthor Commented:

lucky_james:,

Thanx for your comment.

No, not the views, I want the folders. I have also visited your link, but the following line

NotesViewEntryCollection  notesViewCollection =LotusNotesView.AllEntries;

is not working , as attaching dll do not accept something like "LotusNotesView". That is not working. Also I am trying to get the folders, not views.

Thanx
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Amitava_MukherjeeAuthor Commented:
sjef_bosman:

thanx for your code. but

Domino.NotesView allviews[] = ndb.Views;

line not working

thanx
0
 
Sjef BosmanGroupware ConsultantCommented:
Shoot... I don't know, I don't speak C#   :-P

And "line not working", is that the error message you get from the compiler??

It could be one of the following (see code), depending on how the property is really named in C#. In LotusScript it is just Views, see:

http://www-12.lotus.com/ldd/doc/lotusscript/lotusscript.nsf/1efb1287fc7c27388525642e0074f2b6/05492a44c227e11f8525642e007702d7?OpenDocument

And a similar question:
http://stackoverflow.com/questions/1410893/how-to-access-contents-of-folders-created-by-user-in-lotus-notes-using-net
Domino.NotesView *allviews = ndb.Views;
Domino.NotesView *allviews = ndb.getViews();

Open in new window

0
 
Amitava_MukherjeeAuthor Commented:
Thanx sjef_bosman:,

I just used the following lines

            Domino.NotesView nv = ndb.GetView(csAllDocumentsViewName);
            object[] vws = ndb.Views as object[];

It works, thanx a lot
0
 
Amitava_MukherjeeAuthor Commented:
Thanx
0
 
Sjef BosmanGroupware ConsultantCommented:
I could never have guessed that code. Thanks for reporting back!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.