C# – How to access contents of Folders created by user in Lotus Notes Using .NET

clotus-notes

I am getting contents of all views (Folders).Like Inbox,Calendar,ToDo e.t.c.

As mentioned in Title i want to access contents of Folders created my user.
For Example "Folder1" and sub-folder "ABC"

I can do it as:

 NotesView folder = _notesDatabase.GetView("(Folder1)");
 NotesDocument docFolder = folder.GetFirstDocument();

For sub-folder : NotesView folder = _notesDatabase.GetView("(Folder1/ABC)");

But here i need to specify folder name.Which can't be known in advance.
So i can't hard code it.

Is there any way to get only list of User created Folders and Sub-folders?

Best Answer

To iterate over all folders in a mailbox, use NotesDatabase.Views and the isFolder property. Then you can either explicitly exclude ($Inbox), ($Junkmail) et.c. or use the heuristic that folders where the name begins with "(" are system folders:

Dim session As New notessession

Forall fa_view In session.currentdatabase.views
    If fa_view.isFolder() Then
        If Left$(fa_view.name,1) <> "(" Then    Print fa_view.name
    End If
End Forall

Ken Pespisas suggestion to use isPrivate is nicer and will work unless users are allowed to create shared folders. I'm not sure if this is the default Notes access or not.

Related Topic