ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / SaveAsFile Method
A string represent the full path of the output file.
Set to true to overwrite the mapx file if it already exists
Example Version

SaveAsFile Method (Map)
Saves the map as a mapx file. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SaveAsFile( 
   string fullPathToMapXFile,
   bool overwrite
)

Parameters

fullPathToMapXFile
A string represent the full path of the output file.
overwrite
Set to true to overwrite the mapx file if it already exists
Exceptions
ExceptionDescription
value fullPathToMapXFile cannot be null
This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
A suffix of .mapx is added if the filename does not have one or has a different suffix. To overwrite an existing file of the same name, set overwrite = true.
Example
Save Map as MapX
map.SaveAsFile(@"C:\Data\MyMap.mapx", true);
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also