Is it possible to find an unpacked location of an mpk programmatically?

1166
2
10-02-2013 07:13 AM
ReneeCammarere
Occasional Contributor
I have C# code that uses the app.config file to locate a map package ( <add key="EsriRuntimeEditingMapPackageLocation" value="C:/Projects//MyEditingMap.mpk"/> )
This map package is used by the Editor Widget to edit feature classes.  I need to be able to programmatically access the unpacked location of this map package.  I know that I can right-click on the mpk file in Arc Catalog and select Properties, and the ???Unpacked Location??? is indicated.  However, I need this path to be returned in the form of a string in my code.  Is there a way to do this?
I looked into using ArcGISFileHandler but didn't know how I could use this executable for my purposes.
Thanks!
0 Kudos
2 Replies
RichardWatson
Frequent Contributor
I don't know whether there is an API to provide you with the directory you seek.

If you can't get this then you always have the option of unpacking it yourself.  My guess is that the mpk is just a renamed zip file.  There are various open source libraries that you can find which does this.  We use DotNetZip.
0 Kudos
ReneeCammarere
Occasional Contributor
As it turns out, I took a different approach to this problem.  Rather than attempting to access the name of the unpacked location, I re-created the map package, and this time I selected the option "Reference all data", so that the edits would be saved in the location referenced in the map document.
0 Kudos