IPOutlookItemCollection::Add

This method is not supported in Windows CE Platform Builder 3.0.

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

HRESULT Add( IDispatch ** ppolItem );

Parameters

  • ppolItem
    [out] Pointer to a pointer to the new item.

Return Values

S_OK indicates success. If an error occurs, the appropriate HRESULT value is returned.

Remarks

This method creates an item in memory. Call Save on the item to save it to the collection.

Code Example [Visual Basic]

The following Visual Basic® code snippet shows how to add an item to an Items collection:

Sub AddAnItem(polApp As PocketOutlook.Application)
Dim polTask As PocketOutook.TaskItem
Set polTasks = polApp.GetDefaultFolder(olFolderTasks).Items
Set polTask = polTasks.Add()
polTask.Save
End Sub

Code Example [C++]

The following C++ code snippet shows how to add an item to an Items collection:

void CreateTask(IPOutlookApp *polApp)
{
IPOutlookItemCollection *pItems;
ITask *pTask;
pFolder->get_Items(&pItems);
pItems->Add((IDispatch **) &pTask)

// Commit the item to the store
pTask->Save();

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

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later pimstore.h    

See Also

IPOutlookItemCollection::Unknown, IPOutlookItemCollection Property Methods

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.