by Michael S. Kaplan, published on 2007/03/04 20:46 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/03/04/1806607.aspx
Perhaps I have set myself up for this sort of question, in which case I have only myself to blame. :-)
But in the early hours Abbott Fleur asked me via the Contact link:
Using the published api's I can query and list the contents of know tables in an ESE database. I'm sort of flailing trying to get a JET_OBJECTLIST of all the tables (and tableIDs) that exist in an edb.
Could you point me in the proper direction for this?
Thanks
Abbott Fleur
Now it is true that I did point out in Is the Jet no longer invisible? that the Extensible Storage Engine and the "Jet Red" engine used by Microsoft Access share a common heritage.
It is also true that a few years back Beth Scott (then a Jet PM) told me once that for many years there was an effort to keep the two API sets in sync, even though there was no specific plan for one to replace the other.
And it is also true that I have called the Jet "Red" engine before directly, though not as a career or anything. So I am usually not likely to know the answer to a random question like this one.
But it is (unfortunately) also true that I am going to dispel most of above this time since I know the answer....
To get a list of objects, you can call JetGetObjectInfo with an InfoLevel of either JET_ObjInfoList or JET_ObjInfoListNoStats. JetGetObjectInfo will (as the docs claim):
pvResult is interpreted as a JET_OBJECTINFO structure. Information about all objects is retrieved. A temporary table will be created, and the information that is necessary to traverse the temporary table is described in the JET_OBJECTINFO structure. For more information, see JET_OBJECTINFO. If the caller does not want to know the number of records and pages for the object, consider using JET_ObjInfoListNoStats, which might be faster.
I am hesitant to provide sample code since I honestly don't think that anything I used nine years ago to call Jet would be guaranteed to work with ESE today.
But the answer should be enough to get started here (plus realistically set expectations for my ability to answer future questions!). :-)
This post brought to you by ✈ (U+2708, a.k.a. AIRPLANE, a kind of jet)
Koushal on 13 Apr 2007 4:47 AM:
JetOpenFileInstance gives INVALID HANDLE in the OUT parameter but the return value is JET_errSuccess. Why so?
Hi Michael,
pleased to know that there's at least someone who can solve my query regarding the ESE APIs. I am a student and I have a small assignment to be done. My main objective is to read the Exchange Database and transaction log files into memory with the use of the ESE APIs, and then dump the read buffer into an on-disk file. As simple as that. It is just a demonstration of the ESE APIs I'm trying to give to myself so that I can later on develop some backup application, etc.
I've written some code which does the following:
1. Call JetCreateInstance
2. Call JetInit
3. Call JetBeginExternalBackupInstance
4. Call JetBeginSession
5. Open a transaction log file (E00.log) using JetOpenFileInstance
All of these APIs are returning the JET_errSuccess value. But the handle returned by JetOpenFileInstance API as an OUT parameter is invalid. I have first initialized the handle to 0 and even after calling this API, the value of handle remains the same. The API doesnt fail. It returns success return value but the handle to the opened file is invalid. Thus, if I try calling the JetReadFileInstance I get a General Protection Fault.
This code is written in Visual C++, I'm using Visual Studio .NET 2003 / 2005.
I'm executing this code on Windows Server 2003 and I have Exchange Server 2003 Enterprise edition installed.
To get access to the transaction log file, I have stopped the Exchange Information store service from the Control Panel.
Can you tell me what's going wrong here?
Is this the right way of accessing the Exchange database or transaction logs using the ESE APIs?
Will I be able to read e-mails from the exchange database using this approach?
Waiting for your reply,
Michael S. Kaplan on 13 Apr 2007 5:24 AM:
This falls under the category of thimgs I do not know about -- you probably want to ask over on Brett Shirley's blog, or on the Exchange blog?
Jagathish on 30 Jul 2010 12:38 AM:
I think the documentation is wrong. pvResut should be interpreted as JET_OBJECTLIST instead of JET_OBJECTINFO.
referenced by
2007/04/13 ESE is still not so easy for me!