Quality Testing

Quality is delighting customers

Friends Can someone suggest me how to read email in Outlook using VBScript. I was trying to do like this, but it is not showing unread messages.

Set olApp=CreateObject("Outlook.Application")
Set olMAPI=olApp.GetNameSpace("MAPI")
Set oFolder = olMAPI.GetDefaultFolder(6)
Set allEmails = oFolder.Items
unreadCount = 0
For Each email In oFolder.Items
If email.Unread = True Then
MsgBox email.Subject
unreadCount = unreadCount + 1
End If
msgbox unreadCount

Can you please suggest me. Where I am making mistake.

Thanks & Regards,
Robin Tyagi

Views: 181

Reply to This

TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service