none
VBA of add unread Mail to Favorite foldr of Outlook2010 RRS feed

  • Question

  • I want a VBA can add unread mail to favorite folder of Outlook2010, can anyone help to on this?
    Tuesday, October 16, 2012 6:00 AM

Answers

  • Hi Omar,

    Thanks for posting in the MSDN Forum.

    Based on your issue, I think you can try to create a rule which moves the emails to the target folder like this

    Sub MoveToFolder()
     Dim colRules As Outlook.Rules
     Dim oRule As Outlook.Rule
     Dim oMoveTargetFolder As Folder
     Dim oMoveRuleAction As Outlook.MoveOrCopyRuleAction
    
     Set colRules = Session.DefaultStore.GetRules()
     Set oRule = colRules.Create("MoveToFolder", olRuleReceive)
    
     Set oMoveRuleAction = oRule.Actions.MoveToFolder
      With oMoveRuleAction
      .Enabled = True
      .Folder = oMoveTargetFolder 
     End With
    
    End Sub
    

    Hope it helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 19, 2012 8:03 AM
    Moderator

All replies

  • MAPIFolder.Items.Add?

    Which favorite folder do you mean? Public Folders  Favorites folder?


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

    Tuesday, October 16, 2012 11:48 PM
  • thank you for your reply, it is the favorite area on the upper of navigation pane by default, it should contane, Inbox, sendItems and Deleted items.

    as MS said the unread mail should be there as well by default, we found it will miss after logon to OWA base on exchange2010, if will disapeared if the owa do not have "unread mail" added.

    so I want to have a vba or add-on in outlook2010, to make sure user has unread mail entrance in Favorites folder or even a VBS and acceptalbe, we can add it to out logon script.

    do you have any idea of it?

    Wednesday, October 17, 2012 7:56 AM
  • Hi Omar,

    Thanks for posting in the MSDN Forum.

    Based on your issue, I think you can try to create a rule which moves the emails to the target folder like this

    Sub MoveToFolder()
     Dim colRules As Outlook.Rules
     Dim oRule As Outlook.Rule
     Dim oMoveTargetFolder As Folder
     Dim oMoveRuleAction As Outlook.MoveOrCopyRuleAction
    
     Set colRules = Session.DefaultStore.GetRules()
     Set oRule = colRules.Create("MoveToFolder", olRuleReceive)
    
     Set oMoveRuleAction = oRule.Actions.MoveToFolder
      With oMoveRuleAction
      .Enabled = True
      .Folder = oMoveTargetFolder 
     End With
    
    End Sub
    

    Hope it helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, October 19, 2012 8:03 AM
    Moderator
  • Hi Omar,

    Did you solved your issue?

    I will mark Leo's reply as answer, please feel free to unmark it if you don't think so.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, October 23, 2012 6:24 AM
    Moderator