how to create empty folder on google drive?

2020-07-18 05:54发布

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.....

Getting exception:

java.io.FileNotFoundException:/title open failed ENOENT ( no such file or directory)

Caused by: libcore.io.ErrnoException: open failed: ENOENT (no such file or directory)

2条回答
ゆ 、 Hurt°
2楼-- · 2020-07-18 06:25

Solved...

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.

查看更多
Emotional °昔
3楼-- · 2020-07-18 06:34

hmmm, I get "Insufficient permission [403]" error

查看更多
登录 后发表回答