HI
Has anyone been able to work with lotus notes automation classes???
Can you post sample code of how to use these classes. I have setup in VB but
I am not able to port
to C# This is what I have so far - I cannot create a session and not sure
how to setup From/Subject
Thanks
object Session , DB , Memo, Item;
string Server, Mailfile, strSubject,strDest, strCopy, strFilename;
lotus.NOTESSESSION session;
lotus.NOTESDATABASE db;
lotus.NOTESDOCUMENT doc;
lotus.NOTESFORM form;
strSubject = "Test Memo sent at" + System.DateTime.Now.ToString();
strDest = so*****@yahoo.com;
strCopy = "Copyto";
//Session = createobject("Notes.NotesSession"); // Creates a Notes Session
//Type NotesSession = Type.GetTypeFromProgID("lotus.NOTESSESSION");
//session = (lotus.NOTESSESSION)Activator.CreateInstance(Notes Session);
Server = session.GETENVIRONMENTSTRING("MailServer", true); // Read the
current mail server from Notes.ini
Mailfile = session.GETENVIRONMENTSTRING("MailFile", true) ; // Read the
current mail file from Notes.ini
db = (lotus.NOTESDATABASE)session.GETDATABASE(Server, Mailfile,true); // Try
to open the mail Database
if (db == null)
{
MessageBox.Show( "Could not access Notes mail file!","",
MessageBoxButtons.OKCancel); // If Mail db not accessible, return an error
return;
}
doc = (lotus.NOTESDOCUMENT)db.CREATEDOCUMENT(); //Create a memo in the user
's mail file
//doc.Form = "Memo"; //Set the form to be a mail Memo
//doc.AUTHORS = session.USERNAME; //Set the from field (not necessary)
//doc.sendto = strDest; //Set the recipient of the Memo
//doc.copyto = strCopy;
//doc.subject = strSubject; //Give the memo a subject
strFilename = "Somefile.txt";
lotus.NOTESRICHTEXTITEM item =
(lotus.NOTESRICHTEXTITEM)doc.CREATERICHTEXTITEM("B ody");
item.EMBEDOBJECT(1454, "", strFilename,""); //Go to the body of the memo and
embed the attachement
doc.SAVE(0, 1,""); //Save the memo in drafts
doc.SEND(1,""); //Send the memo