Results 1 to 2 of 2

Thread: Accessing Outlooks Outbox

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    UK
    Posts
    46

    Question Accessing Outlooks Outbox

    Hi

    What is the code for accessing the oullook outbox from within vb
    i can send a mail, but would like to be able to check the out and inboxes.

    thank you in advance

    Si

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Remember, that in Outlook the "Outbox" is a very temporary folder. Items get placed in there when the user presses Send. Then the mail message is transmitted and the item is re-filed into the Sent Items folder.

    This bit of code might help....

    VB Code:
    1. Dim myItem As Outlook.MailItem
    2. Set NameSpace = Outlook.GetNamespace("MAPI")
    3. Set myFolder = NameSpace.GetDefaultFolder(6)
    4. ' 6 = Inbox. 4 = Outbox. 5 = Sent Items
    5.     MsgBox "Looking at the first item in " & myFolder
    6.     Set myMsgs = myFolder.Items
    7.     For Each myItem In myMsgs
    8.         MsgBox "Message " & _
    9.             myItem.To & " " & _
    10.             myItem.Subject & " " & _
    11.             myItem.Body & " " & _
    12.             myItem.CreationTime & " " & _
    13.             myItem.Sent
    14.         Exit For
    15.     Next
    16.    
    17.     For Each myItem In myMsgs
    18.         myItem.Display
    19.         Exit For
    20.     Next
    I have declared "MyItem" as an Outlook message, as then you can use the Object Browser in the VB development environment to see what other fields are possible.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width