ODBC guide

Download attachment to local disk


Downloads a single attachment to a local file. Specify the attachment ID and the full path where the file should be saved. You can choose whether to overwrite an existing file, fail if it exists, or skip. Use the attachment ID from a task or project attachment list.

SELECT * FROM download_attachment 
WITH (
   AttachmentId='1208216218258030'
 , TargetFilePath='c:\temp\1208216218258030_AWS-refund-request.png' 
 , FileOverwriteMode=0 --0=AlwaysOverwrite, 1=FailIfExists, 2=SkipIfExists
)