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,strD est, strCopy, strFilename;
lotus.NOTESSESS ION session;
lotus.NOTESDATA BASE db;
lotus.NOTESDOCU MENT doc;
lotus.NOTESFORM form;
strSubject = "Test Memo sent at" + System.DateTime .Now.ToString() ;
strDest = so*****@yahoo.c om;
strCopy = "Copyto";
//Session = createobject("N otes.NotesSessi on"); // Creates a Notes Session
//Type NotesSession = Type.GetTypeFro mProgID("lotus. NOTESSESSION");
//session = (lotus.NOTESSES SION)Activator. CreateInstance( NotesSession);
Server = session.GETENVI RONMENTSTRING(" MailServer", true); // Read the
current mail server from Notes.ini
Mailfile = session.GETENVI RONMENTSTRING(" MailFile", true) ; // Read the
current mail file from Notes.ini
db = (lotus.NOTESDAT ABASE)session.G ETDATABASE(Serv er, Mailfile,true); // Try
to open the mail Database
if (db == null)
{
MessageBox.Show ( "Could not access Notes mail file!","",
MessageBoxButto ns.OKCancel); // If Mail db not accessible, return an error
return;
}
doc = (lotus.NOTESDOC UMENT)db.CREATE DOCUMENT(); //Create a memo in the user
's mail file
//doc.Form = "Memo"; //Set the form to be a mail Memo
//doc.AUTHORS = session.USERNAM E; //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.t xt";
lotus.NOTESRICH TEXTITEM item =
(lotus.NOTESRIC HTEXTITEM)doc.C REATERICHTEXTIT EM("Body");
item.EMBEDOBJEC T(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