views:

478

answers:

2

Hi

In C# Get All the .nsf files(Notes Database) from \data\notes directory and populate it in a Listbox or combo box or in Tree View. I am using "Interop.Domino.dll".

A: 

You could get a directory object and then ask for files by a dos mask from it as an array.

Using System.IO

var di = new DirectoryInfo("\data\notes");
FileInfo[] files = di.GetFiles("*.nsf");

DropDownList ddl = new DropDownList();

for(int i = 0;i<files.Length;i++)
{
     var file = files[i];
     ddl.Items.Add(ListItem.FromString(file.Name));
}
DevelopingChris
He said `ListBox`, `ComboBox`, or `TreeView`, which leads me to believe that he's talking about WinForms, not WebForms.
Adam Robinson
feel free to edit it, I think any list control expresses the point.
DevelopingChris
A: 

If you are running your app from anywhere other than the Domino server, you can use the Notes classes to access the server and loop over all databases. Here is the basic structure:

NotesSession s = new Domino.NotesSessionClass();
s.Initialize("MyPassword");
NotesDbDirectory d = s.GetDbDirectory ("MyServer");
NotesDatabase db = d.GetFirstDatabase();
...

// loop over all DB's
String sPath = db.filePath;
...
db = d.getNextDatabase (db);
...
Ed Schembor