About Trash

About Trash

Contents

Examples

emptyTrash

public void emptyTrash(OAuthToken token, String virtualFolder) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    // permanently delete all trashed items in a virtual folder
    client.deleteTrash(virtualFolder);
}

getTrashedFiles

public List<FileMetadata> getTrashedFiles(OAuthToken token, String virtualFolder) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    // Request a list of files from the trash, sorted by name
    TrashCan trashCan = client.getTrash(virtualFolder, "name+asc", null, null, TrashFilterType.file, true);
    return trashCan.getFiles();
}

restoreFile

public void restoreFile(OAuthToken token, String virtualFolder, String filePath) throws IOException, CloudHttpException
{
    CloudApp app = new CloudApp("appname", "key", "secret", "redirectURI");
    CloudClientContext context = new CloudClientContext(app, token);
    CloudClient client = new CloudClient(context);

    // Restore a deleted file or folder
    File file = new File(virtualFolder, filePath);
    client.restore(Collections.singletonList(file.getAbsolutePath()));
}

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.