Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create folder in Google Drive using .NET API?

I am using C#, Google .NET API. How can I create a folder in Google Drive root location? Any code will be helpful. Thanks

like image 790
Sujit Singh Avatar asked May 23 '12 08:05

Sujit Singh


1 Answers

A folder can be treated as a file with a special MIME type: "application/vnd.google-apps.folder".

The following C# code should be what you need:

File body = new File();
body.Title = "document title";
body.Description = "document description";
body.MimeType = "application/vnd.google-apps.folder";

// service is an authorized Drive API service instance
File file = service.Files.Insert(body).Fetch();

For more details check the docs: https://developers.google.com/drive/folder

like image 102
Claudio Cherubino Avatar answered Sep 25 '22 20:09

Claudio Cherubino