D
D
Djubocco2018-01-08 02:12:16
Visual Basic
Djubocco, 2018-01-08 02:12:16

Why are emails not correctly selected in Outlook when filtering the received date using Restrict?

Good afternoon!
In order to select letters by date of receipt, I use the following construction:

DT = Date - 1 'В качестве даты выставляем вчерашний день
sFilter = "[ReceivedTime]>='" & DT & "'"  'Формулируем выражение для фильтра
Set fld = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Restrict(sFilter) 'Выбираем перечень объектов по фильтру

At the same time, messages that came today are selected (and those that came yesterday should be).
If you set DT = Date - 2, then messages that arrived yesterday will be selected. Although in my view - those that came two days ago should be selected.
Why are messages selected that arrived 1 day later than set in the filter? There is one more strange feature: if the letter arrives on the set day after 23:00, it also gets into the selection.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question