Solved

MS Outlook Move email to folder

Posted on 2016-10-14
2
79 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 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 41844966
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
ID: 41904343
Thanks
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Find out what you should include to make the best professional email signature for your organization.
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

679 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