Namespaces
Variants
Actions
(Redirected from How to save sms list)

Archived:How to save SMS list using PySymbian

Jump to: navigation, search
Archived.png
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


This example writes all the sms from the inbox to a file.

Article Metadata

Code Example
Tested with
Devices(s): S60 3rd Edition FP1 SDK

Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition

Article
Keywords: inbox
Created: cyke64 (31 Mar 2007)
Last edited: hamishwillee (14 Jun 2013)

Contents

Preconditions

The inbox should not be empty. If the inbox is empty, the file created would be blank.

Code Snippet

from time import ctime
 
import codecs
import inbox, appuifw
 
box = inbox.Inbox()
msg = box.sms_messages()
 
f = codecs.open('E:/Others/listSMS.txt', 'w', 'utf8') # open file in UTF8
for i in msg:
f.write(box.address(i))
f.write('\n')
f.write(ctime(box.time(i))) # convert seconds in a string
f.write('\n')
f.write(box.content(i))
f.write('\n')
print i +"th SMS backed up"
f.close()
 
appuifw.note(u'All SMS are backed up!', "info")
 
f = codecs.open('E:/Others/listSMS.txt', 'r', 'utf8')
print f.read()
f.close()

Post Conditions

A text file would be created in E:/Others/.

Download source code

File:Sms backup.zip

Screenshot

How to save sms list.jpg

This page was last modified on 14 June 2013, at 09:34.
170 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