ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / SaveAsAsync Method
The full path to the location where the new project file will be stored, including the file name for the new project file
(optional) A boolean indicating if an existing project file in the specified location with the same name should be overwritten or not. (default value = false)
Example

In This Topic
    SaveAsAsync Method
    In This Topic
    Saves a copy of the current project file (*.aprx) to the specified location with the specified file name, then opens the new project file
    Syntax
    public Task<bool> SaveAsAsync( 
       string savePath,
       bool overwrite
    )
    Public Function SaveAsAsync( _
       ByVal savePath As String, _
       Optional ByVal overwrite As Boolean _
    ) As Task(Of Boolean)

    Parameters

    savePath
    The full path to the location where the new project file will be stored, including the file name for the new project file
    overwrite
    (optional) A boolean indicating if an existing project file in the specified location with the same name should be overwritten or not. (default value = false)

    Return Value

    A Task returning a success result
    Exceptions
    ExceptionDescription
    The save location can not be found or accessed
    The save location may be on a full disk
    There was an unspecified write error while saving
    There was an unspecified error while saving
    Remarks

    Save As provides a way to save a copy of the current project file (*.aprx) in a new location with a new name. If you save the project to another location, folders will be created accordingly to satisfy the provided folder path if they don't already exist. You must have write access to the location where the new project file is stored.

    SaveAsAsync copies the project file only. The new project file continues to reference the same home folder, default geodatabase, and default toolbox as the current project. Paths to these items will be updated appropriately based on the new project file's location. For example, if the current project's default geodatabase is accessed by relative path because the default geodatabase and the project file are stored on the same local disk, such as C:, and you save the new project file to a different local disk drive, such as D:, the new project file will access the same default geodatabase using a fully-qualified path instead of a relative path.

    If you use SaveAsAsync to save the new project file in the same location as the current project with a new name, you have effectively renamed the current project. Afterwards, you can delete the copy of the project file with the old name.

    After successfully creating the new file, the current project is closed and the new project file is opened. See also

    Example
    SaveAs project
    //Saves a copy of the current project file (*.aprx) to the specified location with the specified file name, 
    //then opens the new project file
    await Project.Current.SaveAsAsync(@"C:\Data\MyProject1\MyNewProject1.aprx");
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also