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.
A version of this page is also available for
4/8/2010

The CreateItemmethod creates and gets a POOM item. The item is created in the default folder for the specified type.

Syntax

HRESULT CreateItem(
  int 
olItem,
   IDispatch ** 
ppolItem
);

Parameters

olItem

[in] PIM item type to create. One of the OlItemTypeenumeration values.

ppolItem

[out] Reference to the new 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.

Code Example

The following code example shows how to create a new POOM Contact item.

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 CreateAnItem(IPOutlookApp * polApp)
{
	IContact * pContact;

	polApp->CreateItem(olContactItem,
(IDispatch**)&pContact);

	pContact->Release();
}

Remarks

This method creates an item without having to first retrieve the appropriate folder. The new item is created in memory. You must save the item to the designated collection.

Requirements

Header pimstore.h
Library Pimstore.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2000 and later, Smartphone 2002 and later

See Also