Last active
March 10, 2016 10:52
-
-
Save LindaLawton/038755dbf42a6819731e to your computer and use it in GitHub Desktop.
Gets information about the user, the user's Drive, and system capabilities.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Name: Get | |
/// Description: Gets information about the user, the user's Drive, and system capabilities. | |
/// Documentation: https://developers.google.com/drive/v3/reference | |
/// Service must be authentcated with one of the following scopes: | |
/// DriveService.Scope.Drive: View and manage the files in your Google Drive | |
/// DriveService.Scope.DriveAppdata: View and manage its own configuration data in your Google Drive | |
/// DriveService.Scope.DriveFile: View and manage Google Drive files and folders that you have opened or created with this app | |
/// DriveService.Scope.DriveMetadata: View and manage metadata of files in your Google Drive | |
/// DriveService.Scope.DriveMetadataReadonly: View metadata for files in your Google Drive | |
/// DriveService.Scope.DrivePhotosReadonly: View the photos, videos and albums in your Google Photos | |
/// DriveService.Scope.DriveReadonly: View the files in your Google Drive | |
/// </summary> | |
/// <param name="service">Valid authentcated DriveService</param> | |
/// <returns>About object: Information about the user, the user's Drive, and system capabilities.</returns> | |
public static About Get(DriveService service) | |
{ | |
try | |
{ | |
if (service == null) | |
throw new ArgumentNullException("DriveService service parameter cannot be null."); | |
return service.About.Get().Execute(); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("About.Get Failed " + ex.Message); | |
throw new Exception("AboutGetFailed", ex); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
var response = AboutSample.Get(service);
Console.WriteLine("DisplayName: " + response.User.DisplayName);
Console.WriteLine("Email Address: " + response.User.EmailAddress);
Console.WriteLine("Picture Link: " + response.User.PhotoLink);
Console.WriteLine("Picture Link: " + response.StorageQuota.Limit);
Console.WriteLine("Usage: " + response.StorageQuota.Usage);
Console.WriteLine("Usage in Drive: " + response.StorageQuota.UsageInDrive);
Console.WriteLine("Usage in Trash: " + response.StorageQuota.UsageInDriveTrash);