How to load a password-protected document


Loading a password-protected document

A published map file (PMF) is a document that is created using the ArcGIS Desktop Publisher extension. A PMF can be used in an ArcGIS Engine application by loading it into the MapControl and PageLayoutControl if the PMF was published with access to internal objects.
At the time of publishing, a PMF can be password protected. When loading a PMF, use the IMapDocument::IsPasswordProtected method to determine whether the document is password protected. See the following:
[Java]
// Check if the map document is password protected.

IMapDocument mapDoc = new MapDocument();
boolean protected = mapDoc.isPasswordProtected("c:\\data\\mydoc.pmf");
If the document is password protected, the password must be passed to the IPageLayoutControl::LoadMxFile or IMapControl2::LoadMxFile methods. The following code shows the password as hard coded to highlight how the password is used. However, it makes more sense to prompt the user for a password. For a full code sample that includes making a password prompt and displaying it, see Load a map document into a PageLayoutControl.
[Java]
//Load a password-protected document into a PageLayoutControl. 

String password = "my password";
pageLayoutControl.loadMxFile("c:\\data\\mydoc.pmf", password);


See Also:

Load a map document into a PageLayoutControl




Development licensingDeployment licensing
Engine Developer KitEngine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced