In The Hand LtdIn The Hand
Restrict Method (restriction)
NamespacesInTheHand.WindowsMobile.PocketOutlookPimItemCollectionRestrict(String)
.NET Components for Mobility
Returns a new PimItemCollection that contains only items that pass a specified restriction.
Declaration Syntax
C#Visual Basic
public PimItemCollection Restrict(
	string restriction
)
Public Function Restrict ( _
	restriction As String _
) As PimItemCollection
Parameters
restriction (String)
String that defines which items to include in the new collection. This must contain a Boolean expression that evaluates to TRUE or FALSE for any item. Enclose property names between brackets. Enclose criteria in quotes. You can combine expressions with AND and OR. Comparison operators are the following: <, <=, >, >=, =, or <>.

For example, the restriction string [CompanyName] = "Microsoft" returns a collection of items with Microsoft as the company.

Return Value
A PimItemCollection with only the matching items.
Remarks
A restriction match requires that the item include a value for the property. For example, if you do not set the e-mail address for a contact, the contact will not be found using the restriction string [Email1Address] <> "get@smart.com", even though "no address" is a logical match for "not get@smart.com."
Examples
Restricting where Category is Business and CompanyName is Microsoft.
CopyVB.NET
Dim Strquery As String
Dim MyItems As PimItemCollection
Strquery = "[Categories] = " & ControlChars.Quote & "Business" & ControlChars.Quote
Strquery = strquery & " and [CompanyName] = " & ControlChars.Quote & "Microsoft" & ControlChars.Quote
MyItems = Items.Restrict(strquery)
CopyC#
string Strquery;
PimItemCollection MyItems;
Strquery = "[Categories] = \"Business\" and [CompanyName] = \"Microsoft\"";
MyItems = Items.Restrict(strquery);

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