Mailing List


Active Directory Products
Object Compare
Permission Compare

IPhone Products
Calls To Calendar
SMS To Gmail
Voicemail To Gmail

How Long For Me


NerdyHearn - Blog

<< Back To All Blogs

Reading IPhone Text Messages using C# and SQLite

Friday, September 18th, 2009

As a much more interesting follow up post to my previous post I thought it would be interesting to share my method of accessing IPhone text messages using C# and SQLite.

This is not a "live" method of accessing the text messages, in that it requires that your IPhone be synced using iTunes to get the latest backup of your IPhone. When the backup is completed it backs up all data from your phone's databases, which are based upon SQLite.

After doing some digging through the SQLite databases I found the text messages table, and without further ado, I would like to present how I am reading the text messages from my IPhone:

// The MD5 names always appear to be the same, but if not, you can easily use my previous post, iterate all the files in the Backup directory, and
// then read the text messages based on searching for the proper SQLite database

string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Apple Computer\MobileSync\Backup\99d264810a1a5d5c6de1030dcd2dc6674a8817da";

SQLiteConnection conn = new SQLiteConnection("data source=" + path + "\3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata");
SQLiteCommand comm = new SQLiteCommand("SELECT * FROM message", conn);
SQLiteDataReader reader = comm.ExecuteReader();

while (reader.Read())
DateTime UnixBase = new DateTime(1970, 1, 1, 0, 0, 0, 0);

// The timestamp is based on UNIX Epoch, so this will get you the current date and time
DateTime timeStamp = UnixBase.AddSeconds(Int32.Parse(reader["date"].ToString()));

// The address of the sender
string from = reader["address"].ToString();

// The actual "text" of the message
string text = reader["text"].ToString();

// The ID of the message
string id = reader["ROWID"].ToString();

Hopefully that will help some of you nerds out there trying to take your IPhonedness to the next level.

SMSin' Tom Out.


IPhone CSharp SQLite Howto

Related Blogs

An Update on IPhoneSMSToGmail
Backing up your IPhone SMS Messages to Gmail and Google Apps
No More IPhone for Me
IPhone SMS To Gmail v5.0 Released
IPhone SMS To Gmail v9.0 Released


Currently no comments.

Add A Comment



Email Address: (not public, used to send notifications on further comments)


Enter the text above, except for the 1st and last character:

NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers