Finds the first PimItem in the collection that passes the given restriction.
- restriction (String)
- String that defines which items to find.
The string must contain a Boolean expression that evaluates to TRUE or FALSE for any item.
Enclose property names between brackets.
You can combine expressions with AND and OR.
Comparison operators are the following: <, <=, >, >=, =, or <>.
For example, the restriction string [CompanyName] = "Microsoft" returns the first item that has Microsoft as the company.
The PimItem which is found, or NULL if no item is found which passes the restriction.
An item will not pass a restriction if it does not have the property in question set, regardless of what the restriction string is.
For example, if you do not set the email address of a contact, it will not be found using the string [Email1Address] <> foo@bar.com, even though it does have any e-mail address associated with it.
Note that you cannot find on the following properties: BodyInk, ReminderTime, Recipients.
Use FindNext()()()() to find subsequent items in a collection that pass the restriction.
Find the first task where Category is Personal and it is Completed.
CopyVB.NET
CopyC#
Dim Strquery As String Dim MyTask As Task Strquery = "[Categories] = " & ControlChars.Quote & "Personal" & ControlChars.Quote Strquery = strquery & " and [IsComplete] = " & ControlChars.Quote & "True" & ControlChars.Quote MyTask = Items.Find(strquery)
String Strquery;
Task MyTask;
Strquery = "[Categories] = \"Personal\" and [IsComplete] = \"True\"";
MyTask = Items.Find(strquery);Use the Find method to determine if a particular contact already exists.
CopyVB.NET
CopyC#
Dim criteria As String criteria = "[LastName] = " & ControlChars.Quote & varLName & ControlChars.Quote & " AND [FirstName] = " & ControlChars.Quote & varFName & ControlChars.Quote If appOutlook.Contacts.Items.Find(criteria) Is Nothing Then 'contact does not exist - can create new End If
String criteria = "[LastName] = \"" + varLName + "\" AND [FirstName] = \"" + varFName + "\""; if(appOutlook.Contacts.Items.Find(criteria)==null) { //contact does not exist - can create new }