IPOutlookItemCollection::Restrict
This method is not supported in Windows CE Platform Builder 3.0.
This method creates a new Items collection that contains only items that pass a specified restriction.
HRESULT Restrict( BSTR pwszRestriction,
IPOutlookItemCollection ** ppolItems );
Parameters
pwszRestriction
[in] A restriction 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. You can combine 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.
ppolItems
[out] Pointer to a pointer that points to the new collection of items. This is set to NULL if no item passes the restriction.
Return Values
S_OK indicates success. If an error occurs, the appropriate HRESULT value is returned. If no item matches the restriction, the return value is S_OK and polItem is set to NULL.
Code Example [Visual Basic]
The following Visual Basic® code snippet restricts contacts to with the company name Microsoft:
Sub SetHomeCity(polApp As PocketOutlook.Application)
Dim polContacts As PocketOutlook.Items
Set polContacts = polApp.GetDefaultFolder(olFolderContacts).Items
Set polContacts = polContacts.Restrict("[CompanyName] = \"Microsoft\"")
End Sub
Code Example [C++]
The following C++ code snippet restricts contacts to with the company name Microsoft:
void SetHomeCity(IPOutlookApp *polApp)
{
IFolder *pFolder;
IPOutlookItemCollection *pItems;
// Get the contacts folder
polApp->GetDefaultFolder(olFolderCities, &pFolder);
// Get the contacts Items collection
pFolder->get_Items(&polItems);
// Restrict the collection to Contacts with company set to Microsoft
polItems->Restrict(TEXT("[Company] = \"Microsoft\""), &polItems);
// Release objects
pFolder->Release():
pItems->Release():
}
Requirements
Runs On | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | pimstore.h |
See Also
IPOutlookItemCollection::Unknown, IPOutlookItemCollection PropertyMethods
Last updated on Tuesday, July 13, 2004
© 1992-2000 Microsoft Corporation. All rights reserved.