SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    India
    Posts
    203
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Reading mail from Outlook Express using vbscript

    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
    Next
    msgbox unreadCount


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


    Thanks & Regards,
    Robin Tyagi

  2. #2
    New Member
    Join Date
    Feb 2013
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

  3. #3
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,593
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    I've tried that before. It's a huge pain in the *** to use the Outlook apis. An easier way is to use IMAP or POP api and access the mail box directly. Those are standardized protocols and are easier to work with with open source/off the self mail apis.

    Quote Originally Posted by robin1290 View Post
    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
    Next
    msgbox unreadCount


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


    Thanks & Regards,
    Robin Tyagi
    David Lai
    SDET / Consultant
    LinkedIn profile

  4. #4
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Hey

    Do you need the script for Outlook Express or MS Outlook application?

    For Outlook Express, you can refer my post Software Testing tips: Checking Mail Notification
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:20 PM.

Copyright BetaSoft Inc.