-1

Here's the challange: I want to create a structure of folders in my drive when I begin a new proyect, I want to do it using JS (what according to google is possible), but when I try to see the instructions I get lost. I've already got my client ID and my API Key. I could also to authenticate and see my drive structure, but I can't find the code for creating the folders ¿Could someone please help me on this? Thanks on advance...

2 Answers2

0

You need to use create file endpoint like it is written in this page: https://developers.google.com/drive/api/v3/folder#create_a_folder

Marek Szkudelski
  • 1,102
  • 4
  • 11
  • I have used the code listed in this link. To refer to the drive object I replaced "drive.files.create" with "gapi.client.drive.files.create" to solve the problem "drive is not defined" but then, I don't receive any log message, nor success nor error... – Fernando De Palma Madrid Mar 30 '20 at 14:52
  • @FernandoDePalmaMadrid, please update your question with actual code you've written and errors you've got – Marek Szkudelski Mar 30 '20 at 16:55
  • Here's the complete code. All the processes work fine (Login, list of folders), but the "create" option doesn't work. It does not send anything to the log console. https://drive.google.com/open?id=1EdJgAPBt-sc9Li6ui_Pmvss32tf1FMqD – Fernando De Palma Madrid Mar 30 '20 at 17:21
  • @FernandoDePalmaMadrid, paste function you use to creating folders to your question (you can edit it). It will be better formatted than plain text. Read also that topic: https://stackoverflow.com/help/how-to-ask – Marek Szkudelski Mar 30 '20 at 17:49
  • The code (just for the function itself) is 133 longer than permited... – Fernando De Palma Madrid Mar 30 '20 at 18:14
  • It is plain Javascript project so it could be easy to reproduce problem with https://stackblitz.com/ – Marek Szkudelski Mar 30 '20 at 18:17
0

Finally I found the solution in another post: https://stackoverflow.com/a/44527113/11971139

Thanks to Uri and all the people around here that adds (not the others :)!