Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 01:12, 28 June 2007.

How to create Local Message Folder

From Forum Nokia Wiki

Local folders can be created under the global "Inbox" and under the "My Folders" folders. Access to other locations in the messaging tree is restricted to the system and particular MTMs that own those locations.

To check if a custom folder already exists under the parent folder "My Folders":

TBool CSmsHandler::Check()
{
    CMsvEntry * entry = iSession->GetEntryL( KMsvMyFoldersEntryIdValue );                                                       
    CleanupStack::PushL( entry );                                                                                                        
                                                                                                                                   
    CMsvEntrySelection * entries = entry->ChildrenWithTypeL(KUidMsvFolderEntry);                                                         
                                                                                                                                   
    CleanupStack::PopAndDestroy( entry );                                                                                                                                     
    TInt nCount = entries->Count();                                                                                                      
    TInt found =0;                                                                                                                             
    for ( TInt i=1; i < nCount; i++ )                                                                                                    
    {                                                                                                                                    
                                                                                                                                         
      	TMsvId entryID = entries->At( i );                                                                                                 
      	entry = iSession->GetEntryL( entryID );                                                                                   
      	CleanupStack::PushL( entry );                                                                                                      
      	TMsvEntry msvEntry = entry->Entry();                                                                                               
                                                                                                                                   
      	TPtrC descr = msvEntry.iDetails;  
	  	if (descr.Compare(_L("MyToday"))==0)
	  	{
		  	found =1;
		  	iNewFolderId=entryID ;
	  	}
	  	CleanupStack::PopAndDestroy( entry );
    }                                                                                                                                  
                                                                                                                                      
    delete entries; 
     
    return found;
}

Two files need to be updated

  • msvids.h has to be updated with:
const TMsvId KMsvMyFoldersEntryId=KMsvMyFoldersEntryIdValue;
  • msvstd.hrh has to be updated with:
#define KMsvMyFoldersEntryIdValue 0x1008


To create a custom folder, you can use the following type and MTM settings for the index entry:

TMsvEntry mEntry;
mEntry.iMtm = KUidMsvLocalServiceMtm;
mEntry.iServiceId = KMsvLocalServiceIndexEntryId;
mEntry.iType = KUidMsvFolderEntry;


The following code shows how to create a folder named Wiki under My Folders

TMsvId msvServId;                                                                       
CMsvEntry *entry1 = NULL;                                                                
CMsvEntry * rootEntry = NULL;                                                           
CMsvEntry *entryRootService = NULL;                                                     
 
TInt newFldrID = 0;                                                                     
																						
//Get the entry (whatever is passed in)                                                    
entry1 = iSmsMtm->Session().GetEntryL(KMsvMyFoldersEntryIdValue);                        
CleanupStack::PushL(entry1);                                                             
																					 
if (entry1)                                                                              
{                                                                                      
	msvServId = entry1->OwningService();                                                    
																					 
	entryRootService = iSmsMtm->Session().GetEntryL(msvServId);                            
	CleanupStack::PushL(entryRootService);                                                 
																					 
	rootEntry = iSmsMtm->Session().GetEntryL(msvServId);                                   
	CleanupStack::PushL(rootEntry);                                                        
																					 
	rootEntry->SetEntryL(KMsvMyFoldersEntryIdValue); // set to parent                      
																					 
	TMsvEntry newServiceEntry;                                                             
	TTime ttime;                                                                           
	ttime.HomeTime();                                                                      
	newServiceEntry.iDate = ttime;                                                         
	newServiceEntry.iSize = 0;                                                             
	newServiceEntry.iType = KUidMsvFolderEntry;                                            
	newServiceEntry.iMtm = KUidMsvLocalServiceMtm;                                         
	newServiceEntry.iServiceId = iSmsMtm->ServiceId();                                     
	newServiceEntry.iDetails.Set (_L("Wiki"));                                             
	newServiceEntry.iDescription.Set(KNullDesC);                                           
	newServiceEntry.SetVisible(ETrue);                                                     
																						   
	rootEntry->CreateL(newServiceEntry);                                                   
	newFldrID = newServiceEntry.Id();                                                      
	iNewFolderId=newFldrID;                                                                
	CleanupStack::PopAndDestroy();                                                         
	CleanupStack::PopAndDestroy();                                                         
}

Hence a folder Wiki is created in My Folders folder.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Save msg to folder Amilael General Symbian C++ 1 2006-09-07 11:02
About Log File......... jennie Symbian User Interface 7 2007-10-30 13:17
Cmsventryselection Break point runtime error mubx2000 Symbian Networking & Messaging 19 2006-06-13 11:02
Phone access security witson Mobile Java Media (Graphics & Sounds) 3 2006-12-12 22:08
Read SMS from 6310i piotus PC Suite API and PC Connectivity SDK 1 2004-05-06 08:47
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZmessagingQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX