PC Review


Reply
Thread Tools Rate Thread

Anyone using lotus notes automation classes

 
 
Joe
Guest
Posts: n/a
 
      15th Dec 2006
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 = (E-Mail Removed);

strCopy = "Copyto";

//Session = createobject("Notes.NotesSession"); // Creates a Notes Session

//Type NotesSession = Type.GetTypeFromProgID("lotus.NOTESSESSION");

//session = (lotus.NOTESSESSION)Activator.CreateInstance(NotesSession);

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("Body");

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


 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      16th Dec 2006
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" <(E-Mail Removed)> schreef in bericht
news:%(E-Mail Removed)...
> 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 = (E-Mail Removed);
>
> strCopy = "Copyto";
>
> //Session = createobject("Notes.NotesSession"); // Creates a Notes Session
>
> //Type NotesSession = Type.GetTypeFromProgID("lotus.NOTESSESSION");
>
> //session = (lotus.NOTESSESSION)Activator.CreateInstance(NotesSession);
>
> 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("Body");
>
> 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
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Lotus Notes Automation!!! 23izkool Microsoft Excel Programming 0 5th Mar 2011 11:49 AM
Need help wih Lotus Notes automation Nick via AccessMonster.com Microsoft Access VBA Modules 6 5th Mar 2011 01:38 AM
C# 2.0 (Lotus Notes 6 & 7) Create mail document in draft folder for Lotus Notes SteveM Microsoft ASP .NET 5 28th Aug 2007 05:16 PM
How do I read lotus notes mail files without lotus notes installe. =?Utf-8?B?SG9va2V5?= Microsoft Outlook Discussion 1 29th Jan 2005 09:17 PM
Email Automation: Lotus Notes =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Access Form Coding 1 23rd Jun 2004 10:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:40 PM.