小编Sam*_*aka的帖子

Google DRIVE API V3 - 使用nodejs获取根文件夹ID

我需要获取根文件夹ID和过滤器文件夹,其中根文件夹作为其父文件夹.使用Nodejs和google drive API v3.这是我的代码以及如何更改此代码以获取root folderId?

const service = google.drive('v3');
			service.files.list({
			auth: client2,
			fields: 'nextPageToken, files(id, name, webContentLink, webViewLink, mimeType, parents)'
		  	}, (err, res) => {
			if (err) {
			  console.error('The API returned an error.');
			  throw err;
			}
			const files = res.data.files;
			if (files.length === 0) {
			  console.log('No files found.');
			} else {
				
			  console.log('Files Found!');
			  for (const file of files) {
			  		console.log(`${file.name} (${file.id})`);

			  }
Run Code Online (Sandbox Code Playgroud)

javascript node.js google-drive-api google-api-nodejs-client google-drive-shared-drive

4
推荐指数
1
解决办法
1584
查看次数