Micro Focus QTP (UFT) Forums
I wanted to automate the process of reading new emails - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: I wanted to automate the process of reading new emails (/Thread-I-wanted-to-automate-the-process-of-reading-new-emails)



I wanted to automate the process of reading new emails - amit198026 - 08-30-2010

I wanted to automate the process of reading new emails.
But i am not getting the idea how to do this.
Because i am not able to recognise the object of the new incoming mail.

Please help


RE: I wanted to automate the process of reading new emails - pjeigenn - 09-03-2010

I think that you have to look for a property which readed mail donĀ“t have and new mails do.

Use the object spy to discover this. Count the number of new mails using descriptive programming, and use a For or similar to read all of them.


RE: I wanted to automate the process of reading new emails - Arun Prakash - 09-07-2010

Try to use the below code
Code:
Set olapp = createobject("outlook.application")
set inbox = olapp.getnamespace("mapi").folders

for each fold in inbox
    msgbox fold.name
    If fold.name = "Give The main Folder name" Then
        getsubfolders(fold)
    End If
    
next

    msgbox inbox.count
    sub getunreadmails(objfolder)

        set col = objfolder.items
    
        for each mail in col
            if mail.unread then
                msgbox mail.subject
                msgbox mail.sendername
                msgbox mail.body
                msgbox mail.senton
                mail.unread=false
            end if
        next

    end sub
    sub getsubfolders(objparentfolder)
        set colfolders = objparentfolder.folders
        for each objfolder in colfolders
            set objsubfolder = objparentfolder.folders(objfolder.name)
            if objfolder.name="Give the Sub Folder Name" then
                getunreadmails(objfolder)
            end if
            getsubfolders objsubfolder
        next
    end sub