You must Sign In to post a response.
  • Category: ASP.NET

    How to view outlook mail from the grid

    how to create application to read outlook mail from the grid

    i need only to read/view Message not to send .
  • #768479
    Hi,

    Hope you have initially done all the programming for bringing the Mail to your code. If not you need to perform the following coding.

    1. Add the Microsoft Outlook Dll

    Using Microsoft.Office.Interop.Outlook;


    2. Coding for bringing the mails

    public anyevent()
    {

    Outlook.Application objApplication = new Outlook.Application();
    Outlook.MAPIFolder objInboxEmail = objApplication.ActiveExplorer().Session.GetDefaultFolder(
    Outlook.OlDefaultFolders.olFolderInbox);

    for () // Using Loop grab all the mails

    {

    objSubjectList.Add(((Outlook.MailItem)objInboxEmail.Items[i]).Subject);

    }

    listBox1.DataSource = objSubjectList; // Now you will get the list of all the mails with all the details



    }


    3. Now convert this list into Datatable,So the we can easily map the datatable to Grid.

    //Same event of any sub event

    // populate list
    DataTable ListAsDataTable = BuildDataTable<int>(objSubjectList); // Which you got in last function
    DataView ListAsDataView = ListAsDataTable.DefaultView;

    Thanks,
    Mani


Sign In to post your comments