久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Google Drive SDK 將文件保存在特定文件夾中

Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
本文介紹了使用 Google Drive SDK 將文件保存在特定文件夾中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我一直在嘗試將純文本文件保存到 Android 版 Google 云端硬盤中的特定文件夾中.

I've been trying to save a plain text file into a specific folder in Google Drive on Android.

到目前為止,我已經能夠在 Google 云端硬盤上使用文檔和 快速入門指南做一些朝著正確方向發展的事情,首先我能夠創建一個純文本文件:

So far using the Documentation and QuickStart Guide on Google Drive I have been able to do a few things that are going in the right direction, first I was able to create a plain text file:

  File body = new File();
  body.setTitle(fileContent.getName());
  body.setMimeType("text/plain");
  File file = service.files().insert(body, textContent).execute();

我已經能夠在 Google Drive 的基本目錄中創建一個新文件夾:

I have been able to create a new folder in the base directory of Google Drive with:

  File body = new File();
  body.setTitle("Air Note");
  body.setMimeType("application/vnd.google-apps.folder");
  File file = service.files().insert(body).execute();

我還能夠列出用戶 Google Drive 帳戶中的所有文件夾:

I have also been able to list all of the folders in the user's Google Drive account with:

      List<File> files = service.files().list().setQ("mimeType = 'application/vnd.google-apps.folder'").execute().getItems();
      for (File f : files) {
          System.out.println(f.getTitle() + ", " + f.getMimeType());
      }

但是,我對如何將文本文件保存到 Google Drive 中的文件夾中有點卡住.

However I am a bit stuck on how to save a text file into a folder within Google Drive.

推薦答案

你需要使用 parent 參數通過 insert 將文件放入文件夾中.https://developers.google.com/drive/v2/reference/了解更多詳情文件/插入

You need to use the parent parameter to put a file in a folder using insert. More details at https://developers.google.com/drive/v2/reference/files/insert

類似的東西

File body = new File();  
body.setTitle(fileContent.getName());
body.setMimeType("text/plain");
body.setParents(Arrays.asList(new File.ParentReference().setId(parentId));  
File file = service.files().insert(body, textContent).execute();

這篇關于使用 Google Drive SDK 將文件保存在特定文件夾中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(Google 驅動器 API))
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅動api服務賬戶查看上傳文件到谷歌驅動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
Check progress for Upload amp; Download (Google Drive API for Android or Java)(檢查上傳和進度下載(適用于 Android 或 Java 的 Google Drive API))
主站蜘蛛池模板: 玖玖精品视频 | 日韩不卡av | 亚洲一级黄色片 | 99精品久久久久久中文字幕 | 黄色三级视频 | 欧美精品一二三区 | 亚洲美女视频 | 国产欧美精品一区二区色综合 | 天天插天天狠天天透 | 欧美日韩在线视频观看 | 三级在线播放 | 深夜福利视频在线观看 | 狠狠干天天操 | 四虎激情 | 午夜在线观看视频 | 日本国产在线观看 | 日批视频免费在线观看 | 黄色成年人视频 | 久在线视频| 日日舔 | www4h| 91蝌蚪少妇偷拍 | 成人不卡| a视频在线观看 | 成人免费看 | 97在线观看免费视频 | 欧美亚洲激情 | 黄色片观看 | 午夜视频免费在线观看 | 久久精品一二三 | 蜜臀av性久久久久av蜜臀妖精 | 玖玖在线视频 | 午夜免费视频 | 99热这里 | 日本欧美在线 | 91伦理| 蜜臀久久99精品久久久久宅男 | 亚洲h视频| 国产午夜精品视频 | 亚洲一区二区三区在线视频 | 看片地址|