Results 1 to 4 of 4
  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Items.Restrict(filter) (Outlook 2000+)

    The Items.Restrict(filter) returns a subset collection of whatever's in the Items Collection, and getting the filter syntax right is like mud wrestling. (If youre' wondering about October 25, 2005, the Jewish Holiday calendar is installed.) In the Outlook Immediates window:

    ?Outlook.Session.GetDefaultFolder(olFolderCalendar ).Items.Restrict("[Start] = '10/25/2005' And [AllDayEvent] = True And [Categories] = 'Holiday'").Count
    incorrectly (to my way of thinking) returns 0

    ?Outlook.Session.GetDefaultFolder(olFolderCalendar ).Items.Restrict("[Start] > '10/24/2005' And [End] < '10/26/2005' And [AllDayEvent] = True And [Categories] = 'Holiday'").Count
    correctly returns the 2 Holidays on that day

    Why is it that a filter set for between the previous & next day works, but set for equal to the target date does not? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    -John ... I float in liquid gardens
    UTC -7ąDS

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Items.Restrict(filter) (Outlook 2000+)

    Could it be that old nemesis of all day events, Daylight Savings Time? Does the original filter work with a holiday on, say, 12/25/2005?

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Items.Restrict(filter) (Outlook 2000+)

    If you want to use =, you MUST specify the time. For an all-day event this is midnight:

    Restrict("[Start] = '10/25/2005 0:00 AM' And [AllDayEvent] = True And [Categories] = 'Holiday'")

    See Getting All of a Day's Appointments in Microsoft Outlook (Outlook 2000 Technical Articles)

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Items.Restrict(filter) (Outlook 2000+)

    Thanks Hans, that was it. At one point I messed around with time but didn't get the format right, so presumed that wasn't the problem. Now I get to clean up.
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •