taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
714 stars 87 forks source link

Downloading GMAIL Attachments #234

Closed carbm1 closed 2 years ago

carbm1 commented 2 years ago

I am attempting to automate updating our annotatedAssetIds on our Chromebooks. The only automated way to export from our asset management system is for it to send us an email with an attachment in either pdf, csv, or excel. I am attempting to download the attachment from the email so I can process it and make changes as necessary.

Unfortunately when I have the attachment sent to me as a CSV or XLSX file the attachment is not displayed when running: gam user $GoogleAccount show messages query "has:attachment subject:'Chromebook Serial Numbers' from:'do-not-reply@assettiger.com'" showattachments max_to_show 1

The email displays but not the attachment.

If I have the attachment sent as a PDF then it will show and download correctly using this command: & gam user $GoogleAccount show messages query "has:attachment subject:'Chromebook Serial Numbers' from:'do-not-reply@assettiger.com'" saveattachments overwrite maxtoshow 1 targetfolder "$($currentPath)\temp\Chromebooks"

If I take the original email with the CSV or XLSX and forward it to myself then the attachment will download correctly using the last command.

I'm not sure how to proceed here. It appears that if an email with a CSV or EXCEL attachment is sent from an external email address you can't download the file. However, you can if its a PDF or if you sent it from an internal email address.

Can someone shed some light on the reasons for this behavior?

taers232c commented 2 years ago

Craig,

Contact me directly via Meet/Zoom.

Ross

@.***

On Jan 31, 2022, at 3:28 AM, Craig Millsap @.***> wrote:

I am attempting to automate updating our annotatedAssetIds on our Chromebooks. The only automated way to export from our asset management system is for it to send us an email with an attachment in either pdf, csv, or excel. I am attempting to download the attachment from the email so I can process it and make changes as necessary.

Unfortunately when I have the attachment sent to me as a CSV or XLSX file the attachment is not displayed when running: gam user $GoogleAccount show messages query "has:attachment subject:'Chromebook Serial Numbers' @. @.>'" showattachments max_to_show 1

The email displays but not the attachment.

If I have the attachment sent as a PDF then it will show and download correctly using this command: & gam user $GoogleAccount show messages query "has:attachment subject:'Chromebook Serial Numbers' @. @.>'" saveattachments overwrite maxtoshow 1 targetfolder "$($currentPath)\temp\Chromebooks"

If I take the original email with the CSV or XLSX and forward it to myself then the attachment will download correctly using the last command.

I'm not sure how to proceed here. It appears that if an email with a CSV or EXCEL attachment is sent from an external email address you can't download the file. However, you can if its a PDF or if you sent it from an internal email address.

Can someone shed some light on the reasons for this behavior?

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/234, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL3L4PLVRW3UEIOUIMLUYZW6JANCNFSM5NF7P74Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.