In The Hand LtdIn The Hand
Find Method (restriction)
.NET Components for Mobility
Finds the first PimItem in the collection that passes the given restriction.
Declaration Syntax
C#Visual Basic
public PimItem Find(
	string restriction
)
Public Function Find ( _
	restriction As String _
) As PimItem
Parameters
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.

Return Value
The PimItem which is found, or NULL if no item is found which passes the restriction.
Remarks
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.

Examples
Find the first task where Category is Personal and it is Completed.
CopyVB.NET
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)
CopyC#
String Strquery;
Task MyTask;
Strquery = "[Categories] = \"Personal\" and [IsComplete] = \"True\"";
MyTask = Items.Find(strquery);
Examples
Use the Find method to determine if a particular contact already exists.
CopyVB.NET
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
CopyC#
String criteria = "[LastName] = \"" + varLName + "\" AND [FirstName] = \"" + varFName + "\"";

if(appOutlook.Contacts.Items.Find(criteria)==null)
{
    //contact does not exist - can create new
}
See Also

Assembly: InTheHand.WindowsMobile.PocketOutlook (Module: InTheHand.WindowsMobile.PocketOutlook) Version: 7.0.0.0