Find Method

Find Method

See Also         Example         Applies To

Items collection object: Applies the filter to the Items collection and returns the first Item object matching the filter.

UserProperties collection object: Locates and returns a UserProperty object for the requested property name, if it exists.

Syntax 1

object.Find(Filter)

object   Required. An expression that returns an Items object.

Syntax 2

object.Find(Name, Custom)

object   Required. An expression that returns a UserProperties object.

Filter   Required String. An expression that will evaluate to True or False.

The filter is a string expression containing one or more filter clauses joined by the logical operators And, Not, and Or.

A filter clause is a simple expression that evaluates to True or False; for example, [CompanyName] = "Microsoft".

Note that property names can be used in the expression and are identified and delimited by square brackets. Except for these bracketed property names, only literals are allowed within the expression — variables and constants are not evaluated as part of the expression. However, variables and constants can be used when constructing the expression. See Restrict Method Example for an illustration of how to use a variable when constructing the expression.

Comparison operators allowed within the filter expression include >, <, >=, <=, = and <>.

Logical operators allowed are And, Not and Or.

Name   Required. String. The display name of the requested property.

Custom   Optional. Boolean. True if the requested property is a user (custom) property. False if it is a system property. The default value is True.

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.

Remarks

For the Items collection, Find 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