In C# Get All the .nsf files(Notes Database) from \data\notes directory and populate it in a Listbox

旧街凉风 提交于 2020-01-03 06:49:27

问题


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".


回答1:


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



回答2:


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


来源:https://stackoverflow.com/questions/1238498/in-c-sharp-get-all-the-nsf-filesnotes-database-from-data-notes-directory-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!