【发布时间】:2013-05-02 13:08:44
【问题描述】:
我有一些旧的 VB 代码可以使用有效的 Lotus Notes 发送邮件,我已将其重新编写成 C#,但它的行为不同:
VB:
NotesSession = CreateObject("Notes.Notessession")
NotesDb = NotesSession.GetDatabase("", "")
C#:
_notesSession = new NotesSession();
_notesSession.Initialize(passwordString);
_notesDatabase = _notesSession.GetDatabase( "", "");
首先在 C# 中我需要使用密码初始化 NotesSession,其次它在运行时不接受空字符串参数。抛出异常:“必须提供数据库名称”。
在 VB 和 C# 中,我指的是同一个 COM:Lotus Domino 对象
我需要能够在不指定服务器和数据库文件的情况下调用 GetDatabase。
提前致谢。
解决方案(谢谢大家):
dynamic _notesSession = Activator.CreateInstance(Type.GetTypeFromProgID("Notes.NotesSession"));
_notesDatabase = _notesSession.GetDatabase("", "");
这样你没有智能感知但所有属性和方法都可以找到here
【问题讨论】:
标签: c# vb.net lotus-domino