By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Anyone using lotus notes automation classes

P: n/a
Joe
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
Dec 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Joe,

Your code looks like it is a SMTP class lard with some special Notes
objects.

I would first look here in your case

http://www.systemnetmail.com/

Cor

"Joe" <hc******@yahoo.comschreef in bericht
news:%2***************@TK2MSFTNGP02.phx.gbl...
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


Dec 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.