フォルダの作成
GoogleDriveAPIをJavaScriptで利用します。今回は、フォルダの作成
参考URL
APIドキュメント
Working With Folders
ポイントは「フォルダ」もファイルと同じような感じで操作すること。
ルート直下にフォルダを作成
該当部分のみ
1 2 3 4 5 6 7 |
gapi.client.drive.files.create({ name : 'New Folder', mimeType : 'application/vnd.google-apps.folder', parents: ['root'] }).then(function (response){ console.log(response); }); |
特定のフォルダ配下に新しいフォルダを作成
1 2 3 4 5 6 7 |
gapi.client.drive.files.create({ name : 'New Folder', mimeType : 'application/vnd.google-apps.folder', parents: ['フォルダID'] }).then(function (response){ console.log(response); }); |
これでフォルダを作成できる