Export (0) Print
Expand All

IItem::Copy

Windows Mobile 6.5
4/8/2010

The Copy method creates a copy of a PIM item.


HRESULT Copy(
   IItem ** ppolCopy
);

ppolCopy

[out] Reference to the copied PIM IItem object.

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.

The following code example demonstrates how to use Copy. In the example, pItemCopy contains a copy of the IItem object. All of the properties are copied, including named properties. Named properties created with the PIM_DONTREPLICATE set are not copied though. For more information, see GetIDsFromNames Flags.

Bb446236.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.
HRESULT CopyExample(IItem *pItem)
{
    HRESULT hr = E_FAIL;
    IItem *pItemCopy = NULL;

    hr = pItem->Copy(&pItemCopy);

    if(NULL != pItemCopy)
        pItemCopy->Release();

    return hr;
}

If you modify an item's BodyInk binary stream data (that is, the PIMPR_BODY_BINARY property), you must save the item before copying it—otherwise that property will not be copied.

Streams behave differently depending on whether the item has been saved. You must call IStream::Commit(0) (note the parameter of zero) on the stream before calling IItem::Save on the item. If you do not, then the Item might not be saved. This depends on whether you have previously saved the item.

Both PIMPR_BODY_TEXT and PIMPR_BODY_BINARY are always copied.

Headerpimstore.h
LibraryPimstore.lib
Windows MobilePocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

Reference

IItem

Other Resources


Community Additions

ADD
Show:
© 2014 Microsoft