Skip to content

How to use recycle bin functions

The recycle bin functions can be used for searching and restoring deleted projects and datasets. They can be found in ProjectClient and DatasetClient.

Restoring deleted projects and datasets

If you want to restore previously deleted dataset, you can use one of the following functions in DatasetClient:

RestoreDatasetAsync(Guid datasetId, CancellationToken cancellationToken = default);

RestoreDatasetToLocationAsync(Guid datasetId, RestoreToProjectInput input, CancellationToken cancellationToken = default);

To restore previously deleted project, use functions from ProjectClient:

RestoreProjectAsync(Guid datasetId, CancellationToken cancellationToken = default);

RestoreProjectToLocationAsync(Guid datasetId, RestoreToProjectInput input, CancellationToken cancellationToken = default);

var dataset = await _transferClient.UploadAsync(projectId, filePath);

await _datasetClient.DeleteDatasetAsync(dataset.Id);
...
var input = new RestoreToProjectInput()
{
    TargetProjectId = projectId
};
await _datasetClient.RestoreDatasetToLocationAsync(dataset.Id, input);

Searching deleted projects in ProjectClient

If you want to find deleted project by id, you can call

Task<ProjectOutput> GetDeletedProjectAsync(Guid projectId, CancellationToken cancellationToken = default);

If you want to find all deleted projects, use

Task<DeletedProjectSummaryOutputCollectionResponse> GetDeletedProjectListAsync(CancellationToken cancellationToken = default);

If you want to find all deleted subprojects for a project, use

Task<DeletedProjectSummaryOutputCollectionResponse> GetDeletedSubProjectListAsync(string projectId, CancellationToken cancellationToken = default);

await _projectClient.DeleteProjectAsync(projectId);
...
var delProject = await _projectClient.GetDeletedProjectAsync(projectId);
var delProjectList = await _projectClient.GetDeletedProjectListAsync();
var delSubProjects = await _projectClient.GetDeletedSubProjectListAsync(projectIdStr);

Searching deleted datasets in DatasetClient

If you want to find deleted dataset by id, you can call

Task<DatasetOutput> GetDeletedDatasetAsync(Guid datasetId, CancellationToken cancellationToken = default);

To get list of deleted datasets for a project, use

Task<DeletedDatasetSummaryOutputCollectionResponse> GetDeletedDatasetListAsync(string projectId, CancellationToken cancellationToken = default);

To get list of deleted datasets from ALL projects, use

Task<DeletedDatasetSummaryOutputCollectionResponse> GetDeletedDatasetsFromAllProjectsAsync(CancellationToken cancellationToken = default);

var dataset = await _transferClient.UploadAsync(projectId, filePath);

await _datasetClient.DeleteDatasetAsync(dataset.Id);
...
var delDataset = await _datasetClient.GetDeletedDatasetAsync(dataset.Id);
var delDatasetList = await _datasetClient.GetDeletedDatasetListAsync(projectIdStr);
var delDatasetAll = await _datasetClient.GetDeletedDatasetsFromAllProjectsAsync();

Permanently deleting project from recycle bin

You can permanently delete projects from recycle bin by calling

Task DeleteProjectAsync(Guid projectId, bool permanently = false, CancellationToken cancellationToken = default)

with parameter 'permanently' set to true.

var dataset = await _transferClient.UploadAsync(projectId, filePath);

#soft delete, project is moved to recycle
await _datasetClient.DeleteDatasetAsync(dataset.Id);
...
#hard delete, project is deleted permanently
await _datasetClient.DeleteProjectAsync(dataset.Id, true);