asif basha

asif basha

  • NA
  • 41
  • 0

How to store into contents into back end table

Aug 27 2009 5:22 AM
Imports System.Reflection
Imports outlook = Microsoft.Office.Interop.Outlook
Module Module1

    Sub Main()
        ' Create Outlook application.
        Dim oApp As Outlook.Application = New Outlook.Application()

        ' Get Mapi NameSpace.
        Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
        oNS.Logon("Outlook", Missing.Value, False, True) ' TODO:

        ' Get Messages collection of Inbox.
        Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
        Dim oItems As Outlook.Items = oInbox.Items
        Console.WriteLine("Total : " & oItems.Count)

        ' Get unread e-mail messages.
        'oItems = oItems.Restrict("[Unread] = true")
        'Console.WriteLine("Total Unread : " & oItems.Count)

        ' Loop each unread message.
        Dim oMsg As Outlook.MailItem
        Dim i As Integer

        For i = 1 To oItems.Count
            oMsg = oItems.Item(i)

            Console.WriteLine(i)
            'Console.WriteLine("SenderName :" & oItems.Item(i))
            'Console.WriteLine(oInbox.Items(i).Subject)
            Console.WriteLine(oMsg.SenderName)
            Console.WriteLine(oMsg.Subject)
            Console.WriteLine(oMsg.ReceivedTime)
            'Console.WriteLine(oMsg.Body)
            Console.WriteLine("---------------------------")
        Next
        oItems = oItems.Restrict("[Unread] = true")
        Console.WriteLine("Total Unread : " & oItems.Count)

        Console.ReadLine()

        ' Log off.
        oNS.Logoff()

        ' Clean up.
        oApp = Nothing
        oNS = Nothing
        oItems = Nothing
        oMsg = Nothing
    End Sub

End Module


This code is a console application which gives the output of outlook Inbox contents.I would like to store these inbox contents into back end table of some databse.. And can I access the same table in another webpage gridview of another website??? Is this possible?? If possible how?? Please explain how to store the contents into back end table also please help me out