You Are Here:

Community: Wiki

This page was last modified on 15 September 2009, at 20:41.

Create a contact group

From Forum Nokia Wiki

Reviewer Approved   


The following example shows how to create a group in the contact DB. The created group shows up in the contact groups on the contact application of the device. This kind of behavior might be needed in case you want to create the group progrmatically and do something with it.

Header file required:

#include <cntdb.h>

CContactDatabase link against library cntmodel.lib so add following line to your .mmp file:

LIBRARY   cntmodel.lib

Capabilities:

CAPABILITY WriteUserData

Add following lines in .cpp file.

TInt CreateContactGroupL(const TDesC& aGroupName)
{
TInt err = KErrNone;
CContactDatabase* contactDbHandle;
TRAP(err, contactDbHandle = CContactDatabase::OpenL());
if(err == KErrNone)
{
CContactGroup* contact = static_cast<CContactGroup*>(contactDbHandle->CreateContactGroupL(aGroupName, 0));
CleanupStack::PushL(contact);
TInt groupId = contact->Id(); // this is the group id for your group
contactDbHandle->CloseContactL(groupId); //Make sure to close the contact else no one will be able to use the created group till then..
CleanupStack::PopAndDestroy(contact);
}
return err;
}

Links

Activate contact group view

Find a contact group

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fAccessingE5fdataE5fanywhereE5finE5fapplicationX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZseriesE5f60Q qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxs60X qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ