如何创建谷歌驱动器上的空文件夹? [英] how to create empty folder on google drive?
本文介绍了如何创建谷歌驱动器上的空文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建空的文件夹,我的Android应用程序。
I am trying to create empty folder for my android app..
File body = new File();
body.setTitle("title");
java.io.File fileContent = new java.io.File("title");
FileContent mediaContent = new FileContent("application/vnd.google-apps.folder", fileContent);
File file = service.files().insert(body, mediaContent).execute();
这似乎没有工作......
This doesnt seem to work.....
获取异常:
java.io.FileNotFoundException:/标题打开失败ENOENT(没有这样的文件或目录)
java.io.FileNotFoundException:/title open failed ENOENT ( no such file or directory)
致:libcore.io.ErrnoException:打开失败:ENOENT(没有这样的文件或目录)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (no such file or directory)
推荐答案
解决...
File body = new File();
body.setTitle("title");
body.setMimeType("application/vnd.google-apps.folder");
File file = service.files().insert(body).execute();
这将创建一个名为标题在谷歌驱动器文件夹。
It will create folder named title in google drive.
这篇关于如何创建谷歌驱动器上的空文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文