Project folders#
You can interact with project folders through the API.
Basic operations#
The ROOT project folder can be retrieved with the get_root_project_folder()
method.
root_folder = client.get_root_project_folder()
Alternatively any project folder can be retrieved with its ID with the get_project_folder()
method.
prj_folder = client.get_project_folder(prj_folder_id)
Getting basic attributes:
# Getting the id of a project folder (for "get_project_folder")
id = prj_folder.id
# Getting the name of a project folder:
name = prj_folder.name
# Getting the "virtual path" of a project folder (NB: for information purpose only, does not hold special significance)
path = prj_folder.get_path()
Finding the folder of a project#
From a project, you can find its project folder
project = client.get_project("MYPROJECT")
folder = project.get_project_folder()
print("Project is in folder %s (path %s)" % (folder.name, folder.get_path()))
Creating entities#
To create a child project folder, use the create_sub_folder()
method.
# Creating a new project folder
newborn_child = prj_folder.create_sub_folder(project_folder_name)
# Creating a project directly into a project folder
new_project = prj_folder.create_project(project_key, project_name, owner)
Moving entities#
To move a project folder to another location (into another project folder), use the move_to()
method.
prj_folder.move_to(new_parent)
prj_folder.move_project_to(project_key, new_parent)
You can also move a project directly
project.move_to_folder(target_folder)
Managing project folders#
Deleting a project folder#
prj_folder.delete()
Modifying settings#
pf_settings = prj_folder.get_settings()
pf_settings.set_name(new_name)
pf_settings.set_owner(new_owner)
pf_permissions = pf_settings.get_permissions()
pf_permissions.append(new_permission_item)
pf_settings.save()
Reference documentation#
A handle for a project folder on the DSS instance. |
|
A handle for a project folder settings. |