Bug 56903 - Moz-free Outlook Address Book driver
Summary: Moz-free Outlook Address Book driver
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: reviewed:2022
Keywords: difficultyInteresting, easyHack, skillCpp
Depends on: 56904
Blocks: MozBaseKillOff
  Show dependency treegraph
 
Reported: 2012-11-09 06:11 UTC by Lionel Elie Mamane
Modified: 2023-01-10 21:57 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2012-11-09 06:11:32 UTC
Make a LibreOffice connectivity/sdbc driver that does not use the in-tree ancient Mozilla copy.

The easiest would probably just to access it over ADO (like we do for Microsoft Access files). It needs Jet 4.0, which is bundled with some versions of Windows, but not the most recent ones. But there is a redistributable that we can bundle: "Microsoft Access Database Engine 2010 Redistributable" http://www.microsoft.com/en-us/download/details.aspx?id=13255

To do that, just take inspiration of our drivers for "Microsoft Access" (.mdb) and "Microsoft Access 2007" (.accdb): they just under the hood rewrite the SDBC URL to the right SDBC-ADO URL, possibly set some parameters, and hand off the connection to the SDBC-ADO driver. This would not need *any* mucking with SQL, ADO/Jet handles it all.

The drives are declared in 
connectiviy/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu:

    <node oor:name="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=*" oor:op="replace">

and

    <node oor:name="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=*" oor:op="replace">

See also dbaccess/source/core/misc/dsntypes.cxx function ODsnTypeCollection::extractHostNamePort

Then the SDBC-ADO driver recognises this ":access:" prefix specially:

connectivity/source/drivers/ado/AConnection.cxx function OConnection::construct:

    if ( aDSN.compareToAscii("access:",7) == 0 )

I suggest to introduce an ":outlook:" prefix.


References:
I see several references to
http://msdn.microsoft.com/library/en-us/dnsmart00/html/sa00h12.asp but
it gives me a blank page right now.
Alternative references:
http://support.microsoft.com/kb/275262
http://www.codeproject.com/Questions/192505/Connection-String-for-Outlook-2010
http://www.freevbcode.com/ShowCode.asp?ID=3886
http://vbcity.com/forums/t/6878.aspx
http://msdn.microsoft.com/en-us/library/office/aa160682%28v=office.11%29.aspx



Another path would be to access Outlook directly over COM/... This would need handling the SQL ourselves, like our mork driver does (connectivity/source/drivers/mork)

There are examples (for VBA) there:

http://support.microsoft.com/kb/290792
http://support.microsoft.com/kb/290658
http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/812d1fb3-a997-487e-9c4f-75227521d4b8
http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/1cf06a86-2a28-4359-8046-6c5b5a5fd934
Comment 1 Lionel Elie Mamane 2012-11-12 15:02:20 UTC
David Ostrovsky dixit in http://lists.freedesktop.org/archives/libreoffice/2012-November/040889.html

> I personally think it is a no go to have two different approaches for
> O and OE integration.
> As discussed with Fridrich on LO Congress, i took a look at seamonkey
> way to handle it. They simple open MAPI.DLL
> and use WAB restriction API to access it. Moreover the algorithms and
> the  data strucures in mozab
> (and therefore in mork driver) seems to match 1 to 1 to these api.
> So one straightforward way to integrate both O and OE would be to
> borrow these 5 files from seamonkey tree and adapt it for our need.

As remarked by Michael Meeks in http://lists.freedesktop.org/archives/libreoffice/2012-November/040905.html, following that path, probably better to take that code off *latest* Seamonkey or even better Thunderbird rather than copying the ancient thing we have in-tree.
Comment 2 Björn Michaelsen 2013-10-04 18:47:29 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 3 DavidO 2014-11-04 21:05:30 UTC
So what is the current name for the API?

"Windows Address Book (WAB) API"

or

"Windows Contacts API"

apparently they make a new one with every windows release?
Comment 4 Alex Thurgood 2015-01-03 17:41:18 UTC Comment hidden (no-value)
Comment 5 Robinson Tryon (qubit) 2015-12-13 13:24:12 UTC Comment hidden (obsolete)
Comment 6 Robinson Tryon (qubit) 2016-02-18 14:52:27 UTC Comment hidden (obsolete)
Comment 7 Varena 2018-11-19 11:31:47 UTC Comment hidden (spam)
Comment 8 Hossein 2023-01-10 21:57:29 UTC
Re-evaluating the EasyHack in 2022

This enhancement is still relevant. But things have changed since 2012. I think using Microsoft Jet Database Engine is not the best approach now, as it is currently called a deprecated technology and it does not support 64 bit applications.

(In reply to DavidO from comment #3)
> So what is the current name for the API?
> "Windows Address Book (WAB) API" or "Windows Contacts API"
> apparently they make a new one with every windows release?
As can be read here, "Windows Contacts" is the new application, and API:

"Windows Contacts is a contact manager that is included in Windows Vista, Windows 7, Windows 8, Windows 10, and Windows 11. It replaced but retains most of the functionality of Windows Address Book and worked with Windows Live Mail and the Vista version of Windows Mail."
https://en.wikipedia.org/wiki/Windows_Contacts

Also, Microsoft explicitly says that WAB should not be used, and Windows Contacts API should be used instead, for the new applications:

"New applications should not use this set of interfaces. These interfaces exist for backward compatibility with legacy applications. These interfaces will be unavailable in the future.
In Windows Vista, Windows Contacts replaces Windows Address Book (WAB). For more information about this new mechanism for storing and retrieving contact information, see Windows Contacts."
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wab/-wab-entry

Here, "Programming Windows Contacts" is discussed with many examples:

Programming Windows Contacts
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wincontacts/-wincontacts-example-entry