ahochsteger / gmail-processor

Gmail Processor is an open-source project that automates the processing of Gmail messages and attachments using Google Apps Script and execute actions (e.g. store attachments in a GDrive folder, log information in a spreadsheet) depending on matching criteria.

Home Page:http://ahochsteger.github.io/gmail-processor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scan to shared folder

AntonSlegers-o2o opened this issue · comments

I have a shortcut to a Shared Folder in the root of my own Google Drive.
Unfortunately it's creating a new folder in my root with the exact same name of the shared folder I actually want to scan to.
How can I make the syntax work to let the script know I want to scan to the shared folder?

/**
 * Configuration for Gmail2GDrive
 * See https://github.com/ahochsteger/gmail2gdrive/blob/master/README.md for a config reference
 */
function getGmail2GDriveConfig() {
  return {
    // Global filter
    "globalFilter": "has:attachment -in:trash -in:drafts -in:spam",
    // Gmail label for processed threads (will be created, if not existing):
    "processedLabel": "Scan",
    // Sleep time in milli seconds between processed messages:
    "sleepTime": 100,
    // Maximum script runtime in seconds (google scripts will be killed after 5 minutes):
    "maxRuntime": 280,
    // Only process message newer than (leave empty for no restriction; use d, m and y for day, month and year):
    "newerThan": "1d",
    // Timezone for date/time operations:
    "timezone": "GMT",
    // Processing rules:
    "rules": [
      { // Store all attachments sent to my.name+scans@gmail.com to the folder "Scans"
        "filter": "to:test.test+scans@o2o.be",
        "folder": "'nameofmysharedfolder'",
        "filenameTo": "'scan-'yyyy-MM-dd-'%s.pdf'",
        "archive": true
      }
    ]
  };
}

I managed to resolve it by adding "parentFolderId":"XXXXXXXXXX", I didn't realize it worked for shared folders AND shared drives.