Namespaces
Variants
Actions
Revision as of 06:18, 26 July 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to create folders and Subfolders inside Inbox

Jump to: navigation, search
Article Metadata

Article
Created: balajikrishna (25 Sep 2007)
Last edited: hamishwillee (26 Jul 2012)

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

91 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved