I am using the .NET client library on C# to build a small application for a specific purpose.
I need to return the value of 'gmail_used_quota_in_mb' and 'total_quota_in_mb', and 'used_quota_in_mb'
Based on this page (https://developers.google.com/admin-sdk/reports/v1/reference/usage-ref-appendix-a/users-accounts) I should get the parameters in the output of the request of my application, however I am not getting those values...
I am doing it with the following code:
string nl = Environment.NewLine;
UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { ReportsService.Scope.AdminReportsUsageReadonly },
"user", CancellationToken.None, new FileDataStore("Reports.ListSizes"));
}
// Create the service.
var service = new ReportsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Reports API Sample",
});
try
{
UserUsageReportResource.GetRequest request = service.UserUsageReport.Get("x@y.z", "2016-12-16");
IList<UsageReport> result = request.Execute().UsageReportsValue;
foreach (var item in result)
{
AppendTextBox(textBox1.Text + "User ID=" + item.Parameters[0].StringValue);
// In the Parameters[] array, I get 46 items, none of them is one of the above 3 parameters I am looking for...
}
}
catch(Google.GoogleApiException ex)
{
MessageBox.Show(ex.Message, "Error");
}
In the Parameters[] array, I get 46 items, none of them is one of the above 3 parameters I am looking for...
I took most of the code from the following page and I adapted it to fit my needs for UsageReport: https://developers.google.com/admin-sdk/reports/v1/quickstart/dotnet
I really appreciate any help, as mainly I am a systems engineer and I am working on a G Suite migration project and need to make this application to be able to do the critical part of data migration.
Edit (extra details): Here are all the parameters I get from the output...
accounts:admin_set_name=xxxxx accounts:is_disabled= accounts:disabled_reason= accounts:first_name=xxxxx accounts:is_2sv_enforced= accounts:is_2sv_enrolled= accounts:is_delegated_admin= accounts:is_less_secure_apps_access_allowed= accounts:is_super_admin= accounts:is_suspended= accounts:last_name=xxxxx accounts:num_authorized_apps= accounts:num_roles_assigned= accounts:num_security_keys= accounts:creation_time= accounts:last_login_time= accounts:last_sso_time= accounts:user_has_overridden_name= docs:num_owned_google_documents_created= docs:num_owned_google_documents_edited= docs:num_owned_google_documents_trashed= docs:num_owned_google_documents_viewed= docs:num_owned_google_drawings_created= docs:num_owned_google_drawings_edited= docs:num_owned_google_drawings_trashed= docs:num_owned_google_drawings_viewed= docs:num_owned_google_forms_created= docs:num_owned_google_forms_edited= docs:num_owned_google_forms_trashed= docs:num_owned_google_forms_viewed= docs:num_owned_google_presentations_created= docs:num_owned_google_presentations_edited= docs:num_owned_google_presentations_trashed= docs:num_owned_google_presentations_viewed= docs:num_owned_google_spreadsheets_created= docs:num_owned_google_spreadsheets_edited= docs:num_owned_google_spreadsheets_trashed= docs:num_owned_google_spreadsheets_viewed= docs:num_owned_items_created= docs:num_owned_items_edited= docs:num_owned_items_trashed= docs:num_owned_items_viewed= docs:num_owned_other_types_created= docs:num_owned_other_types_edited= docs:num_owned_other_types_trashed= docs:num_owned_other_types_viewed=
Thanks