CalendarView.Filter Property (Outlook)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns or sets a String value that represents the filter for a view. Read/write.

expression .Filter

expression A variable that represents a CalendarView object.

The value of this property is a string, in DAV Searching and Locating (DASL) syntax, that represents the current filter for the view. For more information about using DASL syntax to filter items in a view, see Filtering Items.

The following Visual Basic for Applications (VBA) example obtains a View object by using the CurrentView property of the Explorer object, then sets the Filter property of the View object to display only those Outlook items that were received last week.

Private Sub FilterViewToLastWeek() 
 Dim objView As View 
 ' Obtain a View object reference to the current view. 
 Set objView = Application.ActiveExplorer.CurrentView 
 ' Set a DASL filter string, using a DASL macro, to show 
 ' only those items that were received last week. 
 objView.Filter = "%lastweek(""urn:schemas:httpmail:datereceived"")%" 
 ' Save and apply the view. 
End Sub