A short time ago a brief study. NET Operations Lotus Notes messages, including the reading and sending of messages, and the inclusion of attachments, referring to the use of IBM Lotus Domino in Microsoft. NET applications, now share the results with you. This article will be divided into three parts for getting a list of users, sending a message, receiving a message, and providing a download of the sample program (Visual Studio 2008) at the end of the article.
Reference
If you want to use. NET Operation Lotus, we can use Lotus Domino Objects to access the Domino object through COM, either on the Domino server or on any of the Notes clients (IBM Lotus Domino Designer, Lotus D Lotus Domino Objects is included in the installation of Omino Administrator or Lotus Notes. If your development environment is compounded by the above requirements, you can add a COM reference: Lotus Domino Objects, and then:
Using Domino;
If you cannot find this COM component, you can register the following components before you can find:
regsvr32 "C:\Program Files\lotus\notes\nlsxbe.dll"
Get the Notes mailbox user list
This code will traverse all users in the user view (People view) and add their full names to the ComboBox control. Create a new two global variable (global to use for other methods in this example).
Notessession NS;
NotesDatabase NDB;
Send mail
This code falls to the user selected from ComboBox to send a message, we can enter the message title and content, and can add attachments.
try
{
if (ns!=null)
{
NotesDocument doc = NDB. CreateDocument ();
Doc. Replaceitemvalue ("Form", "Memo");
//Recipient information
Doc. Replaceitemvalue ("SendTo", Cb_people.text);
//Mail subject
Doc. Replaceitemvalue ("Subject", Tb_subject.text);
//message body
Notesrichtextitem RT = doc. Createrichtextitem ("body");
Rt. AppendText (Tb_body.text);
//Attachment
if (!string. IsNullOrEmpty (Tb_attachment.text))
{
Notesrichtextitem attachment = doc. Createrichtextitem ("attachment");
Attachment. Embedobject (Embed_type. Embed_attachment, "", Tb_attachment.text, "attachment");
}
//Send Message
Object obj = Doc. GetItemValue ("SendTo");
Doc. Send (False,ref obj);
doc = null;
MessageBox.Show ("successfully!");
}
}
catch (Exception ex)
{
MessageBox.Show ("Error:" + ex.) message);
}