Clear old RSS Feeds via VBA or other possible means

Answered Clear old RSS Feeds via VBA or other possible means

  • Friday, August 17, 2012 2:39 AM
     
     
    Dear Expert,
    Do you know how to clear old RSS feeds via VBA or any other possible methods (Except manual delete) please ?
    "Rule" cannot handle this...
    Thanks
    Elton

All Replies

  • Friday, August 17, 2012 4:08 AM
     
     
    By "clear", do you mean delete old items in each RSS feed? Or delete the feeds themselves?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Friday, August 17, 2012 6:28 AM
     
     

    Sorry that I didn't make it clear.

    "Clear" means either moving the old RSS news feed to Deleted Folder or I should say ... delete from inbox.

    Thanks

    Elton

  • Friday, August 17, 2012 4:12 PM
     
     
    Again, move/delete meaning deleting the whole feed (all items and its parent folder) or just old (e.g. before Jan 1 2012) items in a particular folder leaving newer items intact?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Tuesday, August 21, 2012 8:26 AM
     
     

     

    Thanks for reply.

    RSS news will hit my inbox as incoming mails.

    Say I have subscribed the Yahoo news Feed below.

    I config the incoming feed to my inbox.

    Just want to know how to clear (delete or move to trash) rather than manual delete. How to clear those incoming news feed via VBA when we run ....

    Thanks for advice,

    Elton

    Feed: Yahoo! Economy
    Posted on: 21 August 2012 14:06
    Author: Economy, Government & Policy News and Information on Yahoo! Finance
    Subject: Economic data light before Fed minutes

    There are no major economic releases on today's calendar. The weekly ICSC-Goldman same-store sales figures are scheduled for 7:45 am ET. Atlanta Federal Reserve Bank President Dennis Lockhart will speak ...


    View article...

  • Tuesday, August 21, 2012 7:59 PM
     
      Has Code

    Something like the following should do the job:

    set Folder = Application.ActiveExplorer.CurrentFolder
    set Items = Folder.Items
    set Item = Items.Find("([MessageClass] = 'IPM.Post.Rss') AND ([CreationTime] < '2012-1-1') ")
    while Not (Item Is Nothing)
      Item.Delete
      set Item = Items.FindNext
    wend
    


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Tuesday, August 21, 2012 8:00 PM
     
      Has Code

    Or you might want to replace

    set Folder = Application.ActiveExplorer.CurrentFolder
    

    with

    set Folder = Application.Session.GetDefaultFolder(olFolderInbox)


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Thursday, August 23, 2012 6:36 AM
     
     
     

    Hi Dmitry,

    Thanks for reply.

    I used your script in MS Outlook 10. Look like it does not have any changes.

    It did not remove the RSS news.

    Can you advise how to make it through?

    Thanks, Elton

     

    Sub Clear_RSS()
    Set Folder = Application.ActiveExplorer.CurrentFolder
    Set Items = Folder.Items
    Set Item = Items.Find("([MessageClass] = 'IPM.Post.Rss') AND ([CreationTime] < '2012-1-1') ")
    While Not (Item Is Nothing)
      Item.Delete
      Set Item = Items.FindNext
      Wend
    End Sub

  • Thursday, August 23, 2012 1:40 PM
     
     

    Are the conditions in the script correct? What is your definition of "old"?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Thursday, August 23, 2012 1:41 PM
     
     

    And, since you are uising

    Application.ActiveExplorer.CurrentFolder

    not

    Application.Session.GetDefaultFolder(olFolderInbox)

    was the Inbox folder selected?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

  • Friday, August 24, 2012 8:14 AM
     
     

    Ohh. sorry.

    It works well if If I change the date to 2012-8-24...

    Do you know how set the date as "today minus one" in the script?

    Thanks

    Elton


    • Edited by Eltonlaw Friday, August 24, 2012 8:25 AM
    •  
  • Friday, August 24, 2012 2:36 PM
     
     Answered

    Use Now - 1:

    d = Now - 1
    strDate =  year(d) & "-" & month(d) & "-" & day(d)

    Set Item = Items.Find("([MessageClass] = 'IPM.Post.Rss') AND ([CreationTime] < '" & strDate & "') ")


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    • Marked As Answer by Eltonlaw Monday, August 27, 2012 3:55 AM
    •  
  • Monday, August 27, 2012 4:45 AM
     
     
    thank you very much... that's great....