0

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=

ありがとう

4

1 に答える 1

1

ユーザーがレポートを取得する時点でデータを持っていない場合、次の値はレポートに表示されません。

  • drive_used_quota_in_mb
  • gmail_used_quota_in_mb
  • gplus_photos_used_quota_in_mb
  • total_quota_in_mb
  • used_quota_in_mb
  • used_quota_in_percentage

ユーザーがデータを持っている場合、値が表示され、データサイズを比較できます。ユーザーにデータがない場合、これらの値は返されないため、ユーザーのデータ使用量は 0 であると想定します。

レポートを実行していたユーザーが実際にデータを持っていたため、見つけるのに少し時間がかかりましたが、レポートデータが利用可能なメカニズムのために、ユーザーがデータを持っていないときに検索していました. 「all」検索パラメーターを入力すると、検索日より前のデータを持っていた一部のアカウントでこれらの値が取得され、さらに混乱しました。

しかし、今日、静かに座って各ケースを確認することができた後、私はこの結論に達しました. パラメータ出力ページでGoogleがもっと指摘してくれたらいいのに...

于 2016-12-19T15:48:18.703 に答える