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. |
The Itemmethod retrieves an item from a folder, based on the current sort order.
Syntax
HRESULT Item( int iItem, IDispatch ** ppolItem ); |
Parameters
- iItem
-
[in] The one-based index for the item to retrieve. The index is the position of the item in the current sort order.
- ppolItem
-
[out] Reference to the retrieved item. For information about IDispatch, see IDispatch.
Return Value
This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:
- S_OK
-
The method completed successfully.
Remarks
The GetItemIndexFromOidfunction returns a zerobased index value in its dwIndexparameter. Since the IPOutlookItemCollection::Item iItemargument takes a onebased index value, you will receive a "one-off" error when you pass this value to IPOutlookItemCollection::Item—unless you add 1 to it first.
Code Example
The following code example shows how to retrieve an item from an Items collection.
Note: |
---|
To make the following 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. |
Copy Code | |
---|---|
void GetAnItem(IPOutlookApp * polApp) { IFolder * pFolder; IPOutlookItemCollection * pItems; ITask * pTask; // Get the fifth item in the Tasks folder. polApp->GetDefaultFolder(olFolderTasks, &pFolder); pFolder->get_Items(&pItems); pItems->Item(5,(IDispatch **)&pTask); // Do something with the Task ... // Release resources. pFolder->Release(); pItems->Release(); pTask->Release(); } |
Remarks
If the value for iItemis less then zero, or greater than the number of item in this folder, then Itemreturns E_INVALIDARG.
Requirements
Header | pimstore.h |
Library | Pimstore.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |