![]() |
---|
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. |
Adding a PIM item to the Outlook Mobile database involves calling the item's Savemethod.
The Outlook Mobile database consists of three separate PIM item lists contained in the three Default Folders: the Appointments folder, the Tasks folder, and the Contacts folder.
To add a Contact to the Contacts
folder
-
Create an instance of the Outlook Mobile application object and then use it to establish a POOM session. For more information, see Establishing a POOM Session.
-
Create a PIM item. For more information, see Creating a PIM Item.
-
Declare a reference to a generic PIM item collection, as follows:
Copy Code
IPOutlookItemCollection *pItems;
-
Declare a reference to a generic PIM item folder:
Copy Code
IFolder *pFolder;
-
Use the generic PIM item folder to get the Contacts folder:
Copy Code
polApp->GetDefaultFolder(olFolderContacts, &pFolder);
-
Use the Contacts folder to get the collection of Contact items:
Copy Code
pFolder->get_Items(&pItems)
-
Create a new Contact item:
Copy Code
pItems->Add(&pContact)
-
Initialize the new Contact item's data members:
Copy Code
pContact->put_FirstName(TEXT("Michael")); pContact->put_LastName(TEXT("Angelo")); pContact->put_Company(TEXT("Microsoft")); pContact->put_FileAs(TEXT("Angelo"));
-
Save the new Contact item to the database:
Copy Code
pContact->Save();
Example
The following code example demonstrates how to add a new Contactobject to the Contacts folder.
![]() |
---|
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 AddNewContact(IPOutlookApp *polApp) { IPOutlookItemCollection * pItems; IFolder * pFolder; IContact * pContact; hr = polApp->GetDefaultFolder(olFolderContacts, &pFolder); hr = pFolder->get_Items(&pItems) hr = pItems->Add(&pContact) hr = pContact->put_FirstName(TEXT("Michael")); hr = pContact->put_LastName(TEXT("Angelo")); hr = pContact->put_Company(TEXT("Microsoft")); hr = pContact->put_FileAs(TEXT("Angelo")); hr = pContact->Save(); } |
To make the 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.
Compiling the
Code
- Include Header File: PimStore.h
- Linker Dependency: PimStore.lib
See Also
Reference
OlDefaultFoldersOther Resources
Pocket Outlook Object Model Common TasksPocket Outlook Object Model Application Development
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.