list_drives Method
Lists the drives accessible by the user.
Syntax
def list_drives() -> None: ...
Remarks
This method lists the drives accessible to the current user.
Calling this method will fire the on_drive_list event once for each drive, and will also populate the Drive* properties.
If there are still more drives available to list when this method returns, the drive_marker property will be populated. Continue to call this method until drive_marker is empty to accumulate all pages of results in the Drive* properties.
The ListDrivesScope configuration setting can be used to control which drives are listed; by default only drives the user directly owns are returned. Refer to ListDrivesScope for more information.
Note: For use-cases that only make use of the current user's default drive (e.g., when authenticated with a personal Microsoft account), there is no need to ever call list_drives, set the drive property, or use any of the class's other drive-related API members. By default, the drive property and the GroupId and SiteId configuration settings are all empty, which causes the class to use the current user's default drive.
// DriveList event handler. onedrive.OnDriveList += (s, e) => { Console.WriteLine(e.Name); }; do { onedrive.ListDrives(); for (int i = 0; i < onedrive.Drives.Count; i++) { // Process drives here. } } while (!string.IsNullOrEmpty(onedrive.DriveMarker));