Help needed to select all emails in a folder 
Author Message
 Help needed to select all emails in a folder

Hi

Using a example from Sue Mosher i was able to process emails in an Folder
if i manually selected all items in the folder.

What i really want to do is to do this programatically so they can be
processed.

The code below doesn't work but gives you the general idea.

The "Product Logs" lives under the Outlook "Personal Folders" Area.

Quote:
>> Tips, code examples to do this much appreaciated.

    Set objOL = CreateObject("Outlook.Application")
    Set myNameSpace = objOL.GetNamespace("MAPI")
    Set myFolders = myNameSpace.Folders("Personal Folders")

    Set myFolder = myFolders.Item("Product Logs")

    Set objSelection =  myFolder."Select All Mail Items"

    For Each objMsg In objSelection
        If objMsg.Class = olMail Then
.....

Thanks in advance



Mon, 01 Aug 2005 19:53:43 GMT  
 Help needed to select all emails in a folder
You do not need to select all emails in a folder in order to process them. Instead use:

For Each objItem in myFolder.Items
    ' process objItem
Next

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm

Quote:

> Hi

> Using a example from Sue Mosher i was able to process emails in an Folder
> if i manually selected all items in the folder.

> What i really want to do is to do this programatically so they can be
> processed.

> The code below doesn't work but gives you the general idea.

> The "Product Logs" lives under the Outlook "Personal Folders" Area.

> >> Tips, code examples to do this much appreaciated.

>     Set objOL = CreateObject("Outlook.Application")
>     Set myNameSpace = objOL.GetNamespace("MAPI")
>     Set myFolders = myNameSpace.Folders("Personal Folders")

>     Set myFolder = myFolders.Item("Product Logs")

>     Set objSelection =  myFolder."Select All Mail Items"

>     For Each objMsg In objSelection
>         If objMsg.Class = olMail Then
> .....

> Thanks in advance



Wed, 03 Aug 2005 06:29:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help needed to select all messages in a folder

2. Determine Selected Folder and Selected Item in Folder

3. Need Outlook macro to recurse outlook folders and create PDF file of each email

4. Need a program to extract email addresses from MS Outlook 2000 folders/messages

5. how to send notification email when new email arrives (help needed, please)

6. How can I get/guess email address of a folder under the Public Folder

7. How can I get/guess email address of a folder under the Public Folder

8. Folder Open Dialog - How to pre-select folder

9. Email address from a public contact folder - PLEASE HELP

10. Help Requested: Getting Access to select folders in an Explorer Window

11. Help!! Auto Email to query selected addresses

12. MS Access VBA SendObject email phoenomenon - need help

 

 
Powered by phpBB® Forum Software