Restrict Method

Restrict Method

See Also         Example         Applies To

Applies a filter to the Items collection, returning a new collection containing all items from the original which match the filter. This method is an alternative to using the Find method or FindNext method to iterate over specific items within a collection. Find or FindNext is faster than filtering if there are a small number of items. Restrict is useful where performance is not a concern.

Note If you are using user-defined fields as part of a Find or Restrict clause, the user-defined fields must exist in the folder otherwise the code will generate an error stating that the field is unknown. You can add a field to a folder by displaying the Field Chooser and clicking New.

Syntax

objItems.Restrict(Filter)

objItems    Required. An expression that returns an Items collection object.

Filter   Required String. A filter string expression to be applied. For details, see the Find method.

Remarks

This method cannot be used, and will cause an error, with the following properties:

Body

Categories

Children

Class

Companies

CompanyLastFirstNoSpace

CompanyLastFirstSpaceOnly

ContactNames

Contacts

ConversationIndex

DLName

Email1EntryID

Email2EntryID

Email3EntryID

EntryID

HTMLBody

IsOnlineMeeting

LastFirstAndSuffix

LastFirstNoSpace

LastFirstNoSpaceCompany

LastFirstSpaceOnly

LastFirstSpaceOnlyCompany

MemberCount

NetMeetingAlias

NetMeetingAutoStart

NetMeetingOrganizerAlias

NetMeetingServer

NetMeetingType

RecurrenceState

ReplyRecipients

ReceivedByEntryID

RecevedOnBehalfOfEntryID

ResponseState

Saved

Sent

Submitted

VotingOptions