When I run this code , an error came ==>
The permission type field is required.
How can i use multiple Email addressess to share the file of google drive in node js
async function updateFilePermissions(){
try{
const fileId = fileId;
let resourceContents = [{
role: 'writer',
type: 'user',
emailAddress: 'SomeEmail@gmail.com',
},{
role: 'writer',
type: 'user',
emailAddress: 'someEmail@gmail.com'
}];
await drive.permissions.create({
resource: resourceContents,
fileId: fileId,
sendNotificationEmail: true,
fields: '*'
});
/*
webViewLink: View the file in browser
webContentLink: Direct download link
*/
const result = await drive.files.get({
fileId: fileId,
fields: 'webViewLink, webContentLink',
});
console.log(result.data);
} catch (error) {
console.log(error.message);
}
}