Please enable JavaScript to view this site.

QPR Knowledge Base 2023.1

  •      
  • Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGApplication Commands

    Delete

    Scroll Prev Top Next More

    Revision history:

    Introduced in QPR 8.1

     

    Deletes folders, models, and branches from the server. This command can be used to delete specific model version as well as empty branches and folders.

     

    Synopsis:

     

    PGApplication.Delete(ServerModelPath | ServerModelId | ServerFolderId, Operation, Parameters)

     

    Parameters:

     

    ServerModelPath: String. Defines the full path to server model or server folder. |
    ServerModelId: Id. Defines ID of server model or model version. |
    ServerFolderId: Id. Defines the ID of server folder or branch.

     

    Operation: String. Defines the delete operation. Supported operations:

    DeleteModel: String. Delete the server model specified by ID or server path. If model has version control enabled and path/ID refers to the root of the model, then all versions and branches are deleted. Model ID can refer also to a specific model version that is deleted by this operation (see also the DeleteVersion operation).

    DeleteTemplate: String. Delete server template specified by ID or server path.

    DeleteVersion: String.  Delete model version specified by ID or server path + optional version info parameters. Details of deleted version can be defined with version info parameters . If the given server model path or ID refers to some version of model, version info parameters can be used to refer to all versions and branches. Supported parameters: Model.Version, Model.Revision, Model.Branch.

    DeleteBranch: String. Delete model version branch specified by ID or server path + version info parameters. Details of deleted branch must be defined with version info parameters . If the given server model path or ID refers to some version of model, version info parameters can be used to refer to all versions and branches. If parameter "DeleteContent=true" is used, then all model versions under the branch are also deleted. Supported parameters: DeleteContent, Model.Branch.

    DeleteFolder: String. Delete server folder specified by ID or server path. If parameter "DeleteContent=true" is used, then all models and folders under the folder are also deleted. Supported parameters: DeleteContent.

     
    Parameters: String. A semicolon-separated list of parameters for the operation:

    Model.Version: String. Defines the model version that is deleted. If also Model.Branch is defined, the version is searched from that branch only.

    Model.Revision: Integer. Defines the model revision that is deleted. If this is used, Model.Version and Model.Branch parameters are ignored (Model.Revision is always unique).

    Model.Branch: String. Defines the name of the branch that is deleted.

    DeleteContent: true | false. If this is true, all models and model version under the branch or folder are deleted. When this is false, a branch or a folder is deleted only if it is empty.

     

    Required Rights:

     

    Administrator or folder/model administrator depending on what is deleted.

     

    Return Values:

    Below are listed the return values that this function can return:

     

    RV_INVALID_PARAMETER
    RV_MODEL_DOES_NOT_EXIST
    RV_BRANCH_DOES_NOT_EXIST
    RV_FOLDER_DOES_NOT_EXIST
    RV_ITEM_IS_NOT_MODEL
    RV_ITEM_IS_NOT_TEMPLATE
    RV_ITEM_IS_NOT_BRANCH
    RV_ITEM_IS_NOT_FOLDER
    RV_FOLDER_IS_NOT_EMPTY
    RV_CANNOT_DELETE_CHECKED_OUT_MODEL
    RV_CANNOT_DELETE_RESERVED_MODEL
    RV_CANNOT_DELETE_BASE_MODEL_WITH_CHILD_MODELS
    RV_CANNOT_DELETE_DEFAULT_TEMPLATE
    RV_CANNOT_DELETE_LAST_MODEL_VERSION_FROM_ROOT
    RV_NO_RIGHTS_TO_MODEL
    RV_UNKNOWN_ERROR

     

    Example Procedure:

     

    iResult = PGApplication.Delete("\\Temp Folder", "DeleteFolder", "DeleteContent=true")