【问题标题】:Fusion table not shown on Google Drive, while created it using Service account withFusion APIFusion 表未显示在 Google Drive 上,而使用带有 Fusion API 的服务帐户创建它
【发布时间】:2014-07-03 20:42:18
【问题描述】:

请帮助解决这个问题,我使用 Google 服务帐户创建了一个 Fusion 表,即使用 key.p12、服务帐户电子邮件,其中为 Fusion 表激活了服务帐户。 (参考,Alejendro 的好帖,链接:How to authenticate in Fusion tables with Oauth v2

调试期间(Spring-maven 项目) - 我确实看到了新创建的表 - 然后,我插入行数据 - 然后,我看到带有行数据的表格 - 最后,我用完整的数据显示表格

此时,表已在 Google Drive 上创建。 我确实看到了网络流量,即 xxx 请求/秒,这意味着表已创建,我正在访问它,希望它在我的 Google Drive 上创建,但无法在 Google Drive 上看到它

为了将表格从 Google Drive 下载到我的本地机器, 我绝对喜欢在我的 Google Drive 上看到它,然后下载到我的本地机器上 我猜,表隐藏在 Google Drive 下,或者可能是在其他地方创建的,因为网络流量向我显示 xxx request/sec,但不知道如何在 Google Drive 上获取它。

一直在这个问题上并碰壁。请大师帮忙...

代码如下:

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

    // check for valid setup
    if (SERVICE_ACCOUNT_EMAIL.startsWith("Enter ")) {
      System.err.println(SERVICE_ACCOUNT_EMAIL);
      System.exit(1);
    }
    String p12Content = Files.readFirstLine(new File("key.p12"), Charset.defaultCharset());
    if (p12Content.startsWith("Please")) {
      System.err.println(p12Content);
      System.exit(1);
    }
    // service account credential (uncomment setServiceAccountUser for domain-wide delegation)
    GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
        .setJsonFactory(JSON_FACTORY)
        .setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
        .setServiceAccountScopes(FusiontablesScopes.FUSIONTABLES)
        .setServiceAccountPrivateKeyFromP12File(new File("key.p12"))
        // .setServiceAccountUser("user@example.com")
        .build();


    // set up global FusionTables instance
    fusiontables = new Fusiontables.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(APPLICATION_NAME).build();
    // run commands


    listTables();

    String tableId = createTable();

    insertData(tableId);

    ... ... ...
    ... ... ...

【问题讨论】:

    标签: google-drive-api google-api-java-client


    【解决方案1】:

    我自己也遇到了。答案是使用驱动api来共享表或转让所有权。

    https://developers.google.com/drive/web/manage-sharing#retrieving_adding_and_manipulating_permissions

    Permission newPermission1 = new Permission();
    
    newPermission1.setValue('tony@acmecorp.com');
    newPermission1.setType('user');
    newPermission1.setRole('writer');
    
    service.permissions().insert(tableId, newPermission1).queue(batch, callback);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-15
      • 2021-09-30
      相关资源
      最近更新 更多