function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Offline edition data access via XML api?

 I need to create reports in the offline version.


Is there a way to access the the offline line data via the XML API or other means with i.e. Crystal Reports?

Best Answer chosen by Admin (Salesforce Developers) 
Sorry, I see not that I needed to call QueryOffLineDB() thanks!

All Answers


The clients team is going to kill me (you know who you are), but yes, you can gain access to the offline data store.


There are a few ways to go about it, depending on what tech you are using, but the easiest is to use the OfficeToolkit (same as the offline client).


The trick is the Route property on the session. 

Setting the value to true routes all calls to the offline db.


This is an unsupported api but you can do quite a bit through it (normal officetoolkit functions).

You can also use the officetoolkit in offline mod to query the db directly using SQL 92.  The results are in XML.


Other options are to use a standard WSDL client (requires registry mods and you have to know what is supported and what is not in the offline api) or to throw SOAP calls against the offline datastore com component…



Will this functionality ever be added to the offline edition?


Someone already posted the idea:





Thank you foghorn that is good news. Seems pretty strait forward, just need to figure out how to log into salesforce offline. I think I need to have a session before I can change its property. Login() does not seem to support the route property.


My users are working in very remote areas with no internet connection within miles.


Thanks again,




The entire sequence is....


create an instance of the toolkit


set the route property high


call login as you normally would.  If the user has not synced their offline datastore login should tell you (or maybe not, i have not worked on that in a while).


You should also try syncing a user first using offline directly, then trying the offline api login steps.


I am using
C:\Program Files\\OfficeToolkit\4.0\SF_MSApi4.dll


with app and


m_SForceSession4Class.Route = true;


But when I call


QueryResultSet4 qr = m_SForceSession4Class.Query("select name from Contact", false);


Gives the following exception.

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."


Any ideas what is wrong?

And I forgot to mention the same code works fine when Route = false and I have online connectivity. But I need access while offline.
Sorry, I see not that I needed to call QueryOffLineDB() thanks!
This was selected as the best answer

Hi flagrant99

Did you ever get this working? I have tried with the vb code below (using the Office Tookit 4.0 in Excel) and although the login works fine, I cant retrieve any records. It errors on the QueryOfflineDB() function and returns the error "Object Required"



Sub QueryContactData()
    Dim myresult As Boolean
    Set g_sfApi = New SForceOfficeToolkitLib4.SForceSession4
    g_sfApi.Route = True
    myresult = g_sfApi.Login("username", "passwordXXXXXXXXXXX")
    If myresult = True Then
        Dim qr As QueryResultSet4
        Set qr = g_sfApi.QueryOfflineDB("select name from contact")
        Dim mycount As Integer
        mycount = 0
        For Each rec In qr
            mycount = mycount + 1
            If mycount > 200 Then Exit For
        MsgBox ("Record Number " & mycount)
    End If
End Sub