C# で .NET クライアント ライブラリを使用して、特定の目的のための小さなアプリケーションを構築しています。
「gmail_used_quota_in_mb」と「total_quota_in_mb」、「used_quota_in_mb」の値を返す必要があります
このページ ( https://developers.google.com/admin-sdk/reports/v1/reference/usage-ref-appendix-a/users-accounts ) に基づいて、私のリクエストの出力でパラメーターを取得する必要がありますアプリケーション、しかし、私はそれらの値を取得していません...
私は次のコードでそれをやっています:
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");
}
Parameters[] 配列では、46 個の項目を取得しますが、探している上記の 3 つのパラメーターのいずれにも該当しません...
次のページからほとんどのコードを取得し、UsageReport のニーズに合わせて調整しました: https://developers.google.com/admin-sdk/reports/v1/quickstart/dotnet
私は主にシステム エンジニアであり、G Suite 移行プロジェクトに取り組んでおり、データ移行の重要な部分を実行できるようにこのアプリケーションを作成する必要があるため、どんな助けにも本当に感謝しています。
編集(詳細):出力から取得したすべてのパラメーターは次のとおりです...
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= ドキュメント: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=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=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=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=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=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=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=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=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=
ありがとう