Outlook object model - Restrict Method
I’ve been using vbscript to automate tasks and collect data from outlook. Yesterday I was using the restrict method to filter task items in a in a public folder that were created that day so that I could count the items and display it on a web page. I had a bit of trouble at first; I could use a static date value but when I was trying to use a string I was getting an error. I soon realised that I was constructing the code wrong. I thought I’d blog the code that worked as I found it difficult to find any examples online.
I’ve listed 2 examples, the first uses a static date value (note that I’m in Australia so our date settings are dd/mm/yyyy). The second uses a string.
Static value:
Set TodaysTickets = colAssignedItems.Restrict("[CreationTime] > '26/11/2005'")
String Value:
TodaysDate = DateValue(Now())
Set TodaysTickets = colAssignedItems.Restrict("[CreationTime] >'" & TodaysDate & "'")