-
Now I found out how to read mails from outlook, but only from the default inbox folder. How can I read from another folder?
....
Set objNS = objOL.GetNamespace("MAPI")
'get inbox
Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
'loop thru inbox, display items
....
Any input?
-
No Ideas?
Can nobody help me with this?
-
These constants will allow you to read items from the standard Outlook folders.
olFolderDeletedItems
olFolderOutbox
olFolderSentMail
olFolderInbox
olFolderCalendar
olFolderContacts
olFolderJournal
olFolderNotes
olFolderTasks
The following examples should give you an idea on how to point to 'user created' folders and access their mail items.
Example 1
Code:
Set myOLApp = CreateObject("Outlook.Application")
Set myNameSpace = myOLApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myMiscFolder = myInbox.Folders("Misc")
Set myItem = myMiscFolder.Items(1)
Text1.Text = myItem.Body
Example 2
Code:
Set myOLApp = CreateObject("Outlook.Application")
Set myNameSpace = myOLApp.GetNamespace("MAPI")
Set myPubFold = myNameSpace.Folders("Public Folders")
Set myFolder1 = myPubFold.Folders("Folder 1")
Set myFolder2 = Folder1.Folders("Folder 2")
Set myFolder3 = Folder2.Folders("Folder 3")
Set myItem = Folder3.Items(4)
Text1.Text = myItem.Body
Hope this helps.
-
Perfect