Share via


IContact::Save

Send Feedback

The Save method saves a Contact item.

Syntax

HRESULT Save(void);

Return Values

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

To save a contact, you must specify at least one of the following four properties: FirstName, LastName, CompanyName, and FileAs.

Code Example

The following code example creates and saves a new Contact.

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.

void SaveContact(IPOutlookApp * polApp)
{
    IContact * pContact;
    IFolder * pFolder;
    IPOutlookItemCollection * pItems;

    // Create a new contact.
    polApp->GetDefaultFolder(olFolderContacts, &pFolder);
    pFolder->get_Items(&pItems)
    pItems->Add(&pContact)
    pContact->put_FirstName(TEXT("Brian"));
    pContact->put_LastName(TEXT("Fleming"));
    pContact->put_Company(TEXT("Microsoft"));
    pContact->put_FileAs(TEXT("Fleming"));

    // Save the new contact.
    pContact->Save();

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

Requirements

Pocket PC: Pocket PC 2000 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: pimstore.h
Library: pimstore.lib

See Also

How to: Create a PIM Item | IContact | Pocket Outlook Object Model API Interfaces | Pocket Outlook Object Model API Enumerations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.