467,883 Members | 1,269 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,883 developers. It's quick & easy.

Anyone using lotus notes automation classes

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
  • viewed: 12497
Share:
1 Reply
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.

Similar topics

13 posts views Thread by Sateesh | last post: by
10 posts views Thread by hrishy | last post: by
1 post views Thread by Peter Wright | last post: by
reply views Thread by Heinz K | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.