Re: How to create new folder using Google Drive API ??

11,102 views
Skip to first unread message

Vinny P

unread,
May 14, 2013, 5:17:41 PM5/14/13
to google-a...@googlegroups.com
On Monday, May 13, 2013 2:25:32 PM UTC-5, prateek bansal wrote:
In my website i use Google Drive API and i want to create new folder with that username  in my drive when new user sign up.
Please help me..



Hello Prateek,

The Google Drive API allows a developer to create a folder by using the same function that creates a file, except you need to pass it a mime type of "application/vnd.google-apps.folder".

Here's the relevant documentation: https://developers.google.com/drive/folder 


-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

My Go side project: http://invalidmail.com/


prateek bansal

unread,
May 15, 2013, 12:58:34 PM5/15/13
to google-a...@googlegroups.com
Thanks Vinny for reply :)

the Link which you mention is for php .I need Java code.

On Tuesday, 14 May 2013 00:55:32 UTC+5:30, prateek bansal wrote:
Hello friends,

In my website i use Google Drive API and i want to create new folder with that username  in my drive when new user sign up.
Please help me..

Thanks :)

Vinny P

unread,
May 17, 2013, 2:11:21 PM5/17/13
to google-a...@googlegroups.com
On Wednesday, May 15, 2013 11:58:34 AM UTC-5, prateek bansal wrote:
Thanks Vinny for reply :)

the Link which you mention is for php .I need Java code.

The link is https://developers.google.com/drive/folder which does not contain any PHP code. It is a standard REST/JSON response which can be parsed with any JSON library, such as the ones listed here: http://stackoverflow.com/questions/338586/a-better-java-json-library .

Assuming you are using the Java Google Drive library (available here: http://code.google.com/p/google-api-java-client/wiki/APIs#Drive_API ) the relevant code to create a directory is basically:

    File body = new File();
    body.setTitle("Folder-Name-Here");
    body.setMimeType("application/vnd.google-apps.folder");
    File file = service.files().insert(body).execute();
    folderId = file.getId();


(Ignore the "File" object, Google Drive treats directories as a special "file")

prateek bansal

unread,
May 18, 2013, 2:45:33 PM5/18/13
to google-a...@googlegroups.com
Thanks vinny :)

Can you help me in Implementing Server side authorization of google api ??

I read from this link https://developers.google.com/drive/auth/web-server#next_steps .There are some points where i struck .

Thanks in advance :)

Sai Kumar Goppisetti

unread,
Sep 25, 2015, 3:22:38 AM9/25/15
to Google App Engine

Could you please tell how to use in php from this url https://developers.google.com/drive/folder.
I am i confused state   

Nick (Cloud Platform Support)

unread,
Sep 25, 2015, 2:39:51 PM9/25/15
to Google App Engine
Hey Sai,

If you have a specific technical question to ask, I suggest you do it at stackoverflow.com or serverfault.com (for application-programming and system-admin questions respectively). This forum is not really a place for specific technical questions, and this thread is already 2 years old. 
Reply all
Reply to author
Forward
0 new messages