Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This method finds the first Pocket Outlook item in a collection that passes the specified restriction.
HRESULT Find (BSTR pwszRestriction,IDispatch** ppolItem);
Parameters
pwszRestriction
[in] Pointer to a null-terminated Unicode 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: <, <=, >, >=, =, <>.For example, the restriction string [CompanyName] = "Microsoft" returns the first item that has Microsoft as the company.
ppolItem
[out] Pointer to the item found by the method. Set to NULL if no item passes the restriction.
Return Values
S_OK indicates success. If an error occurs, the appropriate HRESULT is returned. If no item matches the restriction, the return value is S_OK and ppolItem is set to NULL.
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]<>someone@example.com, even though "no address" is a logical match for "not someone@example.com."
Find does not support restrictions based on the following item properties: BodyInk, ReminderTime, Recipients.
Use FindNext to find subsequent items in a collection that pass the restriction.
Example
The following code example shows how to set a specified contact's information.
void SetContactInfo (IPOutlookApp *polApp)
{
IFolder *pFolder;
IPOutlookItemCollection *polItems;
IContact *pContact;
// Get the Contacts folder
polApp->GetDefaultFolder (olFolderContacts, &pFolder);
// Get the Contacts Items collection
pFolder->get_Items (&polItems);
// Find Contact by LastName
polItems->Find (TEXT ("[LastName] = \"Sheperdigian\""), (IDispatch**)&pContact);
// Make Microsoft the company name
pContact->put_CompanyName (TEXT ("Microsoft"));
// Release objects
pFolder->Release ();
polItems->Release ();
pContact->Release ();
}
Requirements
OS Versions: Windows CE 2.0 and later.
Header: Pimstore.h.
Link Library: Pimstore.lib.
See Also
IPOutlookItemCollection | IPOutlookItemCollection Properties
Send Feedback on this topic to the authors