Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Locating a particular PIM item within the Outlook Mobile database involves calling the IPOutlookItemCollection::Findmethod on the collection.
The Outlook Mobile database consists of three separate PIM item lists contained in the three OlDefaultFolders: the Appointments folder, the Tasks folder, and the Contacts folder.
To find a task by subject
-
Create an instance of the Outlook Mobile application object and then use it to establish a POOM session. For more information, see Establishing a POOM Session.
-
Declare a reference to a generic PIM item collection:
Copy Code IPOutlookItemCollection *pItems;
-
Declare a reference to a generic PIM item folder:
Copy Code IFolder *pFolder;
-
Declare a reference to a Task item:
Copy Code ITask *pFoundTask;
-
Use the generic PIM item folder to get the Tasks folder:
Copy Code polApp->GetDefaultFolder(olFolderTasks, &pFolder);
-
Use the Tasks folder to get the collection of Task items:
Copy Code pFolder->get_Items(&pItems)
-
Search the collection of Task items for an item that matches your search criteria:
Copy Code pItems->Find(_T("[Subject] = \"meeting\""), reinterpret_cast<IDispatch **>(&pFoundTask));
Example
The following code example demonstrates how to retrieve a Task item from the Tasks folder, based on the information in its Subjectproperty.
Copy Code | |
---|---|
BSTR restriction = "[Subject] = \"meeting\""; void FindTask(IPOutlookApp *polApp, ITask *pFoundTask, BSTR restriction) { IPOutlookItemCollection * pItems; IFolder * pFolder; polApp->GetDefaultFolder(olFolderTasks, &pFolder) pFolder->get_Items(&pItems); pItems->Find(_T(restriction), reinterpret_cast<IDispatch **>(&pFoundTask)); } |
To make the code example easier to read, security checking and error handling are not included.
This code example should not be used in a release configuration unless it has been modified to include them.
Compiling the Code
- Include Header File: PimStore.h
- Linker Dependency: PimStore.lib