download_file Method
This method downloads the file or the contents of the folder specified by the ItemId.
Syntax
def download_file(item_id: str) -> None: ...
Remarks
The method will download the item specified by the ItemId. If local_file is set, the file or folder will be saved to the specified location. Otherwise, the class will use the data from the item_data property; If the item is a directory, it will download the contents (recursively) of the directory as a ZIP file.
Note that the string root may be used as a FolderId to represent the root folder, and the string home may be used as a folder Id to represent the home folder for the current user. Other special id's include:
- favorites
- allshared
- connectors
- box
- top
Name Conflict Resolution
If the overwrite property is set to true, then the class will overwrite a file if one is found at the location specified by the local_file property. If it is set to false, then the class will throw an error if it finds a collision.
If local_file is set, the file will be saved to the specified location; otherwise, the file data will be held by item_data.
To download and decrypt an encrypted file, set encryption_algorithm and encryption_password before calling this method.
Download Notes
Simple Download
A simple download is consistent with setting the local_file to the destination of the file when it is downloaded and then calling the method with the item's id. For example:
shareFile.LocalFile = "../MyFile.zip"; shareFile.DownloadFile(shareFile.Items[0].Id);