Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有C#示例的Google BigQuery_C#_Google Oauth_Google Bigquery_Google Api Dotnet Client - Fatal编程技术网

带有C#示例的Google BigQuery

带有C#示例的Google BigQuery,c#,google-oauth,google-bigquery,google-api-dotnet-client,C#,Google Oauth,Google Bigquery,Google Api Dotnet Client,我需要使用Google BigQuery API查询数据,使用服务帐户调用 然而,我很难找到.NET示例,二进制文件(Google.api.Bigquery.dll)中没有包含任何文档。有谁能向我提供C#.NET的示例用法吗?此信息来自: 该示例演示了如何在Google+api中使用服务帐户。我对它进行了一些编辑,以便与BigQuery一起使用 using System; using Google.Apis.Auth.OAuth2; using System.Security.Cryptogra

我需要使用Google BigQuery API查询数据,使用服务帐户调用


然而,我很难找到.NET示例,二进制文件(Google.api.Bigquery.dll)中没有包含任何文档。有谁能向我提供C#.NET的示例用法吗?

此信息来自:

该示例演示了如何在Google+api中使用服务帐户。我对它进行了一些编辑,以便与BigQuery一起使用

using System;
using Google.Apis.Auth.OAuth2;
using System.Security.Cryptography.X509Certificates;
using Google.Apis.Bigquery.v2;
using Google.Apis.Services;

//Install-Package Google.Apis.Bigquery.v2
namespace GoogleBigQueryServiceAccount
{
class Program
{
    private static String ACTIVITY_ID = "z12gtjhq3qn2xxl2o224exwiqruvtda0i";
    static void Main(string[] args)
    {

        Console.WriteLine("BigQuery API - Service Account");
        Console.WriteLine("==========================");

        String serviceAccountEmail = "SERVICE_ACCOUNT_EMAIL_HERE";

        var certificate = new X509Certificate2(@"key.p12", "notasecret", X509KeyStorageFlags.Exportable);

        ServiceAccountCredential credential = new ServiceAccountCredential(
           new ServiceAccountCredential.Initializer(serviceAccountEmail)
           {
               Scopes = new[] { BigqueryService.Scope.DevstorageReadOnly }
           }.FromCertificate(certificate));

        // Create the service.
        var service = new BigqueryService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = "BigQuery API Sample",
        });

        //Note: all your requests will run against Service.

    }
}

}

您好,先生,这是一个过时的示例和过时的名称空间,甚至我也在寻找一个带有服务帐户以及最新NUGET pacakge名称空间信息的示例。什么是“notasecret”?你应该到这里来吗?这只是文字,保持原样