I need to attach a file to a mail using MailApp.sendEmail Problem I'm running into is that I cannot attach anything from a shared drive, only from personal drive. I'd like to use a shared drive to select which file to attach.
Anyone know if that's even possible?
Update: This is the code that is used to open the picker, currently only working for the personal drive from the user running the script:
function createPicker(token) {
if (pickerApiLoaded && token) {
var picker = new google.picker.PickerBuilder()
// Instruct Picker to display all PDFs in Drive. For other
// views, see https://developers.google.com/picker/docs/#otherviews
.addView(google.picker.ViewId.PDFS)
// Hide the navigation panel so that Picker fills more of the dialog.
.enableFeature(google.picker.Feature.NAV_HIDDEN)
// Hide the title bar since an Apps Script dialog already has a title.
.hideTitleBar()
.setOAuthToken(token)
.setCallback(pickerCallback)
.setOrigin(google.script.host.origin)
// Instruct Picker to fill the dialog, minus 2 pixels for the border.
.setSize(DIALOG_DIMENSIONS.width - 2,
DIALOG_DIMENSIONS.height - 2)
.build();
picker.setVisible(true);
} else {
showError('Unable to load the file picker.');
}
}
I'd like to edit this so I can access a shared drive. I've found some stuff that uses GDrive API to access shared drives (also using picker) but I'm missing the experience to successfully edit it.
This is what I meant: https://developers.google.com/drive/api/v3/enable-shareddrives