在 C# 中,从 \data\notes 目录获取所有 .nsf 文件(Notes 数据库)并将其填充到列表框中

发布于 2024-07-29 20:10:17 字数 101 浏览 5 评论 0原文

在 C# 中,从 \data\notes 目录获取所有 .nsf 文件(Notes 数据库),并将其填充到列表框或组合框或树视图中。 我正在使用“Interop.Domino.dll”。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空袭的梦i 2024-08-05 20:10:18

如果您从 Domino 服务器以外的任何地方运行应用程序,则可以使用 Notes 类访问服务器并循环访问所有数据库。 这是基本结构:

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

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);
...
梦在夏天 2024-08-05 20:10:17

您可以获取一个目录对象,然后通过 dos 掩码将其作为数组请求文件。

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

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));
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文