Hi all,
Shortly after posting I discovered that the mobile cache files (MapSchema.bin, MobileCache.db & MobileCache.db-journal) could be refreshed/recreated using the CreateMobileCache geoprocessing tool found under the Mobile toolbox (this toolbox had to be added in ArcCatalog).
The folder "C:\arcgisserver\directories\arcgismobile\WindowsMobile\Projects" contains a sub-folder with a long multi-character name that corresponds to a specific mobile project. In my case it is "15db82b9bdba47aba3b3b2c337249d0f". In this folder, the [project name].wmpk file can be found as well as a folder called esriinfo. In the esriinfo folder, there are 3 sub-folders and an xml file. The sub-folders are mobilecaches, project & thumbnail. In the mobilecaches folder there will be as many sub-folders in this folder as there are mobile services in your operational layers in MPC. In my case I only have a single service. The folder is named after the service name. In this folder you will find the three mobile cache files. When running the geoprocessing tool mentioned above, you can output the mobile cache files to the mobilecaches folder & the existing folder & files will be overwritten or you can output them elsewhere and manually copy them across.
However, when a mobile device connects to your ArcGIS Server, it retrieves the [project name].wmpk file. This file is nothing more than a ZIP file. If you are familiar and confident with changing file extensions, then you can rename the file to [project name].zip and open the zip file with WinZip/WinRAR/7zip etc. The zip file contains the same folder structure as mentioned above (esriinfo\...). Locate the mobilecaches folder and the sub-folder in there with the name of your service. Here you will find the three mobile cache files. You can drag & drop your updated mobile cache files here to update the ones in the zip file. Once the zip file has been closed, rename the zip file back to [project name].wmpk
I still have one stumbling block though as far as the automation of the above process. It lies with the Create Mobile Cache geoprocessing tool. When run from ArcCatalog/ArcMap it works perfectly but since I am trying to automate the above I am scripting the process using Python. I have created a python script shown below:
[INDENT]#Name: CreateMobileCache_mobile.py
# Purpose: Create mobile cache to reflect latest changes to GDB domains referenced by SDE feature class layers in the map document
# Import system modules
import arcpy
arcpy.ImportToolbox("C:\\Program Files (x86)\\ArcGIS\\Mobile3.0\\ArcToolbox\\Toolboxes\\Mobile Tools.tbx")
try:
#Set local parameters
mxdName = "C:\\ArcGISData\\MDRTB\\ArcMapMXDs\\MDRTB_MOBILE_SDE.mxd"
fldName = "C:\\arcgisserver\\directories\\arcgismobile\\WindowsMobile\\Projects\\15db82b9bdba47aba3b3b2c337249d0f\\esriinfo\\mobilecaches"
# Process: Create the mobile map cache using the map document
arcpy.CreateMobileCache_mobile( mxdName,fldName,"#","#","#" )
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message[/INDENT]
I get the following error when running the script:
[INDENT]Line 18
CreateMobileCache() takes no arguments (5 given)[/INDENT]
This doesn't make sense as the geoprocessing tool requires at LEAST 2 parameters to work and its saying that it doesn't take any?
If I don't add the line arcpy.ImportToolbox(...) then running the script fails with the following error:
'module' object has no attribute 'CreateMobileCache_mobile'
It would seem that Python doesn't know where the python scripts are that correspond to the two mobile geoprocessing tools. Is there somewhere that the path to these python scripts can be added so that Python knows where to find them as it does for all other ArcGIS geoprocessing tools? Maybe if this was added then I wouldn't be getting the first error listed.
Could anyone with a bit more knowledge about Python scripting shed some light on this please???
Alan