Discuss this help topic in SecureBlackbox Forum

Clouds: Delete file

To delete a file

  1. Obtain the instance of TElGoogleDriveFile or TElGoogleDriveDocument for the file to be deleted.
  2. If you wish just to move the file to trash, call its Trash() method. After calling this method the object remains functional and you still able to call its methods. it is possible to restore the file back from trash by calling its Untrash() method. The file will be restored in the same parent folder from which it was moved to trash.
  3. In order to permanently delete the file, call its TElGoogleDriveDataStorageObject.Delete() method. After calling this method, the object is freed/disposed, and other methods of this object MUST NOT be called, otherwise you'll get an exception.

C#:


// get an object for the file by its ID
TElGoogleDriveFile file = storage.AcquireObject(@"...") as TElGoogleDriveFile;
Console.WriteLine("File: {0} (trashed: {1})", file.Name, file.Trashed);

// mark the file as trashed
file.Trash();
Console.WriteLine("File: {0} (trashed: {1})", file.Name, file.Trashed);

// removed the trashed mark
file.Untrash();
Console.WriteLine("File: {0} (trashed: {1})", file.Name, file.Trashed);

// permanently delete the file and dispose the file object
file.Delete();

How To articles about Google Drive cloud

Discuss this help topic in SecureBlackbox Forum