Accessing the address book programmatically?
Hi,
I would like to integrate the user's address book (or more specifically the contact details of the current user) into my own (c++) desktop (Windows/MacOS/Linux) application for the user's convenience.
Is this possible at all? If so, where can I start reading to find out how to do this?
(If it's not possible through an API, is the address book file format documented somewhere, so I can read it directly?)
I don't need write access. I just need to be able to read the user's contacts.
Cheers, James
Soluție aleasă
The file is abook.sqlite and is in the profile. You can locate profile by this: - click help>troubleshootinginformation - scroll down to 'profile folder' an click 'open folder'
Citește acest răspuns în context 👍 0Toate răspunsurile (7)
"(or more specifically the contact details of the current user)"
Sorry, that didn't make much sense. I meant the contact details of the current user's contacts as well as the email address(es) of the current user.
It is as SQL database, so I would expect there are ways to do that. Here is an example: https://www.sqlite.org/quickstart.html
Oh, if that's the case then that will be easy enough. Thanks.
Is the DB schema documented at all? And how do I locate it on disk?
Cheers, James
Soluție aleasă
The file is abook.sqlite and is in the profile. You can locate profile by this: - click help>troubleshootinginformation - scroll down to 'profile folder' an click 'open folder'
Ok, I have something working for me.
Is there anyway to determine the address book location for the currently logged in user without the UI? I.e., is it always in known, specific locations on Windows, Linux, and MacOS?
For example, will the location on Windows always be: <RoamingAppData>\Thunderbird\Profiles\<ProfileIdent>\abook.sqlite?
Are there similar fixed locations on the other platforms?
Cheers, James
This is not really the platform for detailed programing information. You might do better using the relevant topicbox lists.
https://thunderbird.topicbox.com/latest Or consulting the developer documentation. https://developer.thunderbird.net/
Things to note The Windows store version of Thunderbird is in some Microsoft defined sandbox. The profile will not be anywhere you might assume is about all I can say. Last I heard Thunderbird could not find it using the button in troubleshooting. But then apparently neither can Firefox and I would expect it to get a fix for that first. (bigger programing team)
Recent adoption of snap packages in Ubuntu and subordinate distributions again introduces a sandbox and some weird restrictions. Apparently if the profile existed before the snap was installed the location is different from if it was created post the switch to SNAP. All in all I have avoided even trying to understand this recent fetish with sandboxing of application that essentially need access to the entire file system and most of the operating system for notifications.
Ah, ok.
That's fair enough. I did actually skim through the documentation before asking here, but I couldn't find what I was looking for. (And most of what I did read seemed woefully out of date and full of dead links.)
I have what I need for now though, so I guess I can just read more later if and when I need to.
Cheers, James