Lotus Notes Domino deveploppment in C#

I read the docment :

在 Microsoft .NET 应用程序中使用 IBM Lotus Domino

看下面代码,用VB写的:

Dim ns As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    If Not (ns Is Nothing) Then
      ns.Initialize("password")
      db = ns.GetDatabase("ServerName//Domain", "names.nsf", False)
      If Not (db Is Nothing) Then
        doc = db.CreateDocument()
        doc.ReplaceItemValue("Form", "Memo")
        doc.ReplaceItemValue("SendTo", cboNames.SelectedText + "//Domain")
        doc.ReplaceItemValue("Subject", txtSubject.Text)
        Dim rt As NotesRichTextItem
          rt = doc.CreateRichTextItem("Body")
          rt.AppendText(rtbBody.Text)
            doc.Send(False)
          rt = Nothing
            doc = Nothing
            lblMessage.Text = "Message Sent."
      End If
      db = Nothing
      ns = Nothing
    End If
    Catch ex As Exception
      lblMessage.Text = "Error: " + ex.Message.ToString()

根据这些我用C#重写了一遍,想要实现从Domino数据库中打开一个DOCument.

public class VD
    {

       NotesSession notesS = new NotesSession();
       NotesDatabase notesDB = new NotesDatabase();
       NotesDocument notesDoc = new NotesDocument();
       public VD()
        {
            try

          {

          if(notesS!=null)

              {
                notesS.Initialize("*****");
                notesDB = notesS.GetDatabase("*****", "*******", false);
             }

          }

          catch 
            {
             }

        }

    }

 

结果无法 使用 VD vd1=new VD();

抛出一个 错误

修改为:

public class VD
    {

       NotesSession notesS ;
       NotesDatabase notesDB ;
       NotesDocument notesDoc ;
       public VD()
        {
            try

          {

                 notesS.Initialize("*****");
                notesDB = notesS.GetDatabase("*****", "*******", false);
             }

            catch 
            {
             }

        }

    }

抛出Object reference not set to an instance of an object. 错误

想了想问题可能出现在类型 NotesSession ,  NotesDatabase ,  NotesDocument 是INTerface. 这方面我很薄弱。下功夫。。。。

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12591435/viewspace-79973/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12591435/viewspace-79973/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值