NetTalk Central

NetTalk E-Mail => E-Mail - Ask For Help => Topic started by: debraballenger on November 14, 2013, 10:47:26 AM

Title: Rename Attacment when downloaded
Post by: debraballenger on November 14, 2013, 10:47:26 AM
I am using the NetEmailReceive and when I downloadi the attachments, I want to rename the file to contain an ID so that 2 files are never named the same thing.

What embed point can I do this change in?

Thanks!
Debra
Title: Re: Rename Attacment when downloaded
Post by: Bruce on November 15, 2013, 01:47:02 AM
NetEmail._SaveFile Procedure (*string writeString, string fileName, long dataLen=0)

In other words, before the parent call, make your own call to the Parent using a different second parameter (then return before the generated parent call)

For example

thisEmail._SaveFile Procedure (*string writeString, string fileName, long dataLen=0)
somename  string(255)
  code
  somename  = clip(fileName)   random(100000,999999) ! clearly nonsense, because of the extension
  parent._SaveFile (writeString,somename ,dataLen)  ! generated parent call
  return

  parent._SaveFile (writeString,fileName,dataLen)  ! generated parent call


Setting of Somename is a bit more complicated because you need to remove the extension part of the name, change the name, put the extension back. But you get the idea.
Title: Re: Rename Attacment when downloaded
Post by: Wolfgang Orth on January 23, 2014, 03:42:38 AM

somename  =   FORMAT(TODAY(), D10-) &'_'& FORMAT(CLOCK(), @T04-) &'_'&  random(100000,999999)  &'_'&  clip(fileName)


like:
2014-01-23_21-32-54_12345678_filename.XLS