You Are Here:

Community: Wiki

This page was last modified on 30 March 2009, at 05:11.

How to create folders and Subfolders inside Inbox

From Forum Nokia Wiki

One can create folders or service entries inside standard messaging folders like InBox or Drafts. The following code for creating subfolders does not result in the creation of a subfolder in older versions of S60 3rd Edition. However it works properly in S60 3rd Edition FP1.


Hearders Required:

#include <msvapi.h> 
#include <msvstd.h >

Library required:

LIBRARY   msgs.lib

Member Variables

CMsvSession* iSession;
// *this represents a class derived from MMsvSessionObserver
iSession = CMsvSession::OpenSyncL(*this);
 
CMsvOperationActiveSchedulerWait * iWaitOp;
 
CMsvEntry* iEntry1;

Functions

void CreateFolder()
{
TMsvEntry folderEntry;
folderEntry.iDescription.Set(_L("Folder"));
folderEntry.iDetails.Set(_L("Folder"));
folderEntry.iType = KUidMsvFolderEntry;
folderEntry.iMtm = KUidMsgTypeSMS;
folderEntry.SetReadOnly(EFalse);
folderEntry.iServiceId = KMsvGlobalInBoxIndexEntryId;
folderEntry.iDate.UniversalTime();
folderEntry.SetVisible(ETrue);
folderEntry.SetStandardFolder(ETrue);
 
TMsvSelectionOrdering sort1;
CMsvEntry* parenfolderEntry = CMsvEntry::NewL
(*iSession,KMsvGlobalInBoxIndexEntryId,sort1);
 
if (!iWaitOp)
{
iWaitOp = CMsvOperationActiveSchedulerWait::NewLC();
CleanupStack::Pop(iWaitOp);
}
CMsvOperation * pCreateFolderOp = parenfolderEntry->CreateL
(folderEntry,iWaitOp->iStatus);
CleanupStack::PushL(pCreateFolderOp);
iWaitOp->iStatus = KRequestPending;
iWaitOp->Start();
CleanupStack::PopAndDestroy(pCreateFolderOp);
CMsvEntrySelection* sel= parenfolderEntry->ChildrenWithMtmL
(KUidMsgTypeSMS);
TMsvId mtmid;
 
mtmid = sel->At(0); //Folder1 Entry Id
CreateSubFolderL(mtmid);
 
}
 
void CreateSubFolderL(TMsvId aParentId)
{
TMsvEntry subfolderEntry;
subfolderEntry.iDescription.Set(_L("SubFolder"));
subfolderEntry.iDetails.Set(_L("SubFolder"));
subfolderEntry.iType = KUidMsvFolderEntry;
subfolderEntry.iMtm = KUidMsgTypeSMS;
subfolderEntry.iServiceId = aParentId;
subfolderEntry.SetVisible(ETrue);
subfolderEntry.SetStandardFolder(ETrue);
subfolderEntry.iDate.UniversalTime();
TMsvSelectionOrdering sort2;
iEntry1 = CMsvEntry::NewL(*iSession, aParentId,sort2);
iEntry1->CreateL(subfolderEntry,iStatus);
SetActive();
}

Related Links

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