Share via


PimItemCollection.Restrict Method

3/29/2010

Creates a new PIM item collection that contains only PIM items that match a set of filter criteria. This provides a filtered view of a collection of PIM items.

Namespace: Microsoft.WindowsMobile.PocketOutlook
Assembly: Microsoft.WindowsMobile.PocketOutlook (in microsoft.windowsmobile.pocketoutlook.dll)

Syntax

public PimItemCollection Restrict (
    string restriction
)
'Declaration
Public Function Restrict ( _
    restriction As String _
) As PimItemCollection

Parameters

  • restriction
    A string that defines which items to find. The string must contain a Boolean expression that evaluates to either TRUE or FALSE for any item. Enclose property names between brackets, and enclose string property values between quotes. Comparison operators are the following "<, <=, >, >=, =, <>", and you can combine expressions with AND and OR.

Return Value

The collection of PIM items matching the restriction.

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]<>"me@microsoft.com", even though the value of Email1Address is not "me@microsoft.com".

Example

In this example, myRestrictedCollection contains Appointments that occur only on 2/22/2008.

AppointmentCollection c = myOutlookSession.Appointments.Items;
AppointmentCollection myRestrictedCollection = c.Restrict("[Date] >= 2/22/2008 0:0 AND [Date] <= 2/23/2008 0:0");

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

PimItemCollection Class
PimItemCollection Members
Microsoft.WindowsMobile.PocketOutlook Namespace