SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Aug 2008
    Posts
    224
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Outlook object dynamic problem

    Hi All,
    i have a script that is going over a specific folder in the outlook application and it deleted any email that doesn't have predefined subject.
    the script is counting the emails in the folder and than run(using for loop) on all the emails in the folder, the problem is that while the script is running there are new email coming and the counter of the for loop become not relevant any more and i'm getting an error message(array is out of bounds)after the script ran for a while.
    how can i solve the problem?should i copy the folder to another temp folder and run through it or is there a better solution for this problem.
    thanks in advanced

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Outlook object dynamic problem

    What i do in such cases is to create a rule which moves these mails to a Pending folder, then my script reads the first mail in the pending folder, processes it and moves it to the processed folder. This was i am always checking the 1st email in pending and count or dynamic emails do not cause an issue

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Outlook object dynamic problem

    Hi,

    Try retrieving the count of items dynamically(for each loop of comparison) and count from last to first.so that even if the new mail comes, your counter counts it dynamically and increases your mail count.(keep counter in the loop).

    regards,

  4. #4
    Senior Member
    Join Date
    Aug 2008
    Posts
    224
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Outlook object dynamic problem

    Thanks man i did it and it's working but sometimes it miss few emails,i gusee it's because i didnt sort it to start from the end to the begining.
    how can i do that?through the outlook or through the QTP?
    Thanks

  5. #5
    Member
    Join Date
    Apr 2008
    Posts
    77
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Outlook object dynamic problem

    Hey,
    i have written a piece of code you can build around it:

    Set obj = CreateObject("outlook.application")
    Set NamSpace = obj.getnamespace("MAPI")
    For i = 1 To NamSpace.GetDefaultFolder(6).items.Count
    If NamSpace.GetDefaultFolder(6).items(i).Subject = "something" Then
    NamSpace.GetDefaultFolder("olFolderInbox")(i).Dele te
    End If
    Next

    This checks from the end by default.

    regards,

 

 

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.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:24 PM.

Copyright BetaSoft Inc.