Solved

MS Outlook Move email to folder

Posted on 2016-10-14
2
36 Views
Last Modified: 2016-11-28
Is there any way to setup a vb script in outlook to move specific email base on a specific  days of the week and time  without the account receiving a notification alert first.  I setup a  vb script that move the emails based on the criteria above but by the time it move the emails the user with this account get the alerts notifications.
0
Comment
Question by:Shen
2 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
The Application.NewMail Event will be triggered before rules and notifications are processed, so looks like the proper way to do it in Outlook VBA.
It does not work for offline (non-cached) Exchange profiles, though. And you need to search for the mail, as this is just a generic notification about new mail coming in, without having a reference to that mail. On the other hand, your VBS code should be similar already, and so you might be able to migrate that into the following:
Public WithEvents olApp As Outlook.Application

Public Sub Application_Startup()
  set olApp = Outlook.Application
End Sub

Private Sub olApp_NewMail()
   ' Now first check the time of day (and other criteria), then get the Inbox, and check the mail against the criteria.
End Sub

Open in new window

I prefer to use Items.ItemAdd (which is triggered by every single mail/object), but that might be called after rules.

A rule applied before any other rule is another way to directly trigger VBA code in Outlook. You can not trigger based on time, so you'll have to check the time and probably other contraints in VBA itself again. The pro with this is that you'Ve got the email (Item) object already as a parameter, like with ItemAdd.
0
 

Author Closing Comment

by:Shen
Comment Utility
Thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now