Ask a questionAsk a question
 

AnswerAccess Lotus Notes Mail

  • Thursday, September 25, 2008 10:37 AMbslim Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi all,

    I need to access Lotus Notes Mail and read the mail subject. If the mail subject matches my requirement, I will need to download the attachment.

    But I am not sure how to connnect to lotus mail and retrieve the mail subject.

    Does anyone know of any classes that can connect to lotus notes?

    Thanks

Answers

  • Thursday, September 25, 2008 10:57 AMCoder24.com Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi - I think my information can help...

    Try by using a Microsoft Office Outlook class by importing the refernces and Dynamic Link Libraries (DLL).

    I hope this information could solve your problem...

    Best regards,
    Fisnik
    Coder24.com
    • Marked As Answer byXun Ye Monday, September 29, 2008 6:52 AM
    •  

All Replies

  • Thursday, September 25, 2008 10:57 AMCoder24.com Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi - I think my information can help...

    Try by using a Microsoft Office Outlook class by importing the refernces and Dynamic Link Libraries (DLL).

    I hope this information could solve your problem...

    Best regards,
    Fisnik
    Coder24.com
    • Marked As Answer byXun Ye Monday, September 29, 2008 6:52 AM
    •  
  • Thursday, September 25, 2008 11:02 AMThomas Koelle Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    My advice would be to see if it exposes any webservices that you can use.
    • Proposed As Answer byXun Ye Monday, September 29, 2008 6:52 AM
    •  
  • Saturday, November 07, 2009 12:09 PMPreeti ChauhanKohli Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    I found following solution in C# Code.
    Have one window base application and make one button on it and one listbox.



    using

     

    Domino;

    using

     

    System.IO;

    using

     

    System.Collections;


     

    StreamReader reader;

     

    int Mailcnt = 0;

     

    string AttachmentName;

     

    StringBuilder sp = new StringBuilder();

     

    private void button1_Click(object sender, EventArgs e)

    {

     

    int numberDocs = 0;

     

    try

    {

     

    NotesSession notesSession = new NotesSessionClass();

    notesSession.Initialize(

    string.Empty);

     

    NotesDatabase notesDB;

    notesDB = notesSession.GetDatabase(

    "", @"C:\Documents and Settings\preeti.chauhan\Desktop\NSF File\Abreu w_2 Collado_001.nsf", false);

     

    if (!notesDB.IsOpen)

    {

    notesDB.Open();

    }

     

    if (notesDB != null)

    {

     

    object[] views = (object[])notesDB.Views;

    LNViews =

    new ArrayList();

     

    for (int i = 0; i < views.Length; i++)

    {

     

    NotesView view = views[i] as NotesView;

    LNViews.Add(view);

     

    if(view.Name!=null)

    lstView.Items.Add(view.Name);

     

    else

    lstView.Items.Add(

    "Blank-null");

    }

     

     

    for (int i = 0; i < views.Length; i++)

    {

     

    NotesView view = views[i] as NotesView;

    LNViews.Add(view);

    lstView.Items.Add(view.Name);

     

     

     

    if (view.Name.StartsWith("Documents")) // Lets Process this view

    {

     

    ProcessView(view);

    }

     

    else if (view.Name.StartsWith("All Documents"))

    {

    ProcessView(view);

    }

     

     

    }

     

     

     

    }

     

     

     

    }

     

    catch (Exception ex)

    {

     

    MessageBox.Show(ex.Message);

    }

     

    MessageBox.Show(Convert.ToString(numberDocs));

    }

     

    private void ProcessView(NotesView vW)

    {

     

    NotesDocument nDoc; int numberDocs = 0;

     

     

     

     

    nDoc = vW.GetFirstDocument();

     

    while (nDoc != null)

    {

    numberDocs++;

     

    object[] objects = (object[])nDoc.Items;

     

    StringBuilder sp = new StringBuilder();

     

    Hashtable Properties = new Hashtable();

    sp = FileStringBuilder(sp);

     

     

    foreach (object ob in objects)

    {

     

    NotesItem notesItem = (NotesItem)ob;

     

    if (notesItem.Name != null)

     

    if (!Properties.Contains(notesItem.Name))

    Properties.Add(notesItem.Name, notesItem.Text);

     

    if (notesItem.Name == "$FILE")

    {

     

    object[] values = (object[])notesItem.Values;

    AttachmentName =

    "";

     

    foreach (object o in values)

    {

    SaveAttachment(nDoc, o.ToString());

     

    if (AttachmentName != "")

    AttachmentName =

    "," + o.ToString();

     

    else

    AttachmentName = o.ToString();

    }

    }

    }

    WriteHtmlfile(sp, Properties);

    Properties.Clear();

    nDoc = vW.GetNextDocument(nDoc);

    }

    }

     

    private static void SaveAttachment(NotesDocument nDoc, string fileName)

    {

     

    NotesEmbeddedObject attachment = nDoc.GetAttachment(fileName);

     

    if (attachment != null)

    {

     

    Console.WriteLine("Saving new attachment to file " + fileName);

    attachment.ExtractFile(

    "C:\\NSF\\NSFOutput\\SampleOutput\\LotusNotes\\ " + fileName);

    }

    }

     

    private StringBuilder FileStringBuilder(StringBuilder sb)

    {

     

    StreamReader reader = new StreamReader(@"C:\NSF\NSFOutput\Template.htm");

    sb.Append(reader.ReadToEnd());

    reader.Close();

     

    return sb;

    }

     

    private void WriteHtmlfile(StringBuilder sp, Hashtable tble)

    {

     

    if (tble["From"] != null)

    {

    sp.Replace(

    "#From#", tble["From"].ToString());

    }

     

    if (tble["PostedDate"] != null)

    {

    sp.Replace(

    "#Sent#", tble["PostedDate"].ToString());

    }

     

    if (tble["SendTo"] != null)

    {

    sp.Replace(

    "#To#", tble["SendTo"].ToString());

    }

     

    if (tble["Subject"] != null)

    {

    sp.Replace(

    "#Subject#", tble["Subject"].ToString());

    }

     

    ////To make new lines in the template file.

     

    if (tble["Body"] != null)

    {

     

    string body = tble["Body"].ToString();

     

    string ToBody = body.Replace("\r\n", "<br>");

    sp.Replace(

    "#Body#", ToBody);

    }

     

    StreamWriter writer = new StreamWriter(@"C:\\NSF\\NSFOutput\\nsfhtmlfile\\" + Mailcnt + ".htm");

    writer.Write(sp.ToString());

    writer.Close();

    Mailcnt += 1;

    }



    But my problem regarding lotus notes is:
    I want to extract email, document calender etc everything and need to store on the disk as a native file(as original file).
    In above code we make the html file.
    is anyone know, how to extract document or emails from lotus notes directly and save to disk.