Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IPOutlookItemCollection::Add

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

The Add method creates a new item for a folder in the Items collection. The item type depends on the folder type.


HRESULT Add(
   IDispatch ** ppolItem
);

ppolItem

[out] Reference to the new item. For information about the VARIANT_BOOL type, see the union member of the PROPVARIANT structure.

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.

This method creates an item in memory. You must still save the item to the collection.

The following code example shows how to add an item to an Items collection.

Aa909263.note(en-us,MSDN.10).gifNote:
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.
void CreateTask(IPOutlookApp * polApp)
{
    IFolder                 * pFolder;
    IPOutlookItemCollection * pItems;
    ITask                   * pTask;

    polApp->GetDefaultFolder(olFolderTasks, &pFolder);

    pFolder->get_Items(&pItems);

    pItems->Add((IDispatch**)&pTask);

    // Commit the Task item to the Item Store.
    pTask->Save();

    // Release objects.
    pFolder->Release();
    pItems->Release();
    pTask->Release();
}

Headerpimstore.h
LibraryPimstore.lib
Windows Embedded CEWindows CE 2.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2014 Microsoft