Archived:How to save SMS list using PySymbian
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.
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
Source file: Media:sms_backup.zip
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
(08 May 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/.



19 Sep
2009
24 Sep
2009