×
Namespaces

Variants
Actions

How to create folders and Subfolders inside Inbox

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: balajikrishna (25 Sep 2007)
Last edited: hamishwillee (14 Jun 2013)

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 Symbian 3rd Edition. However it works properly in Symbian 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

This page was last modified on 14 June 2013, at 09:34.
57 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×