Saving Email Attachments

Question:

I need to get the filenames of an e-mail’s attachments (to store in a data store), once finished I want to save the attachments.

To do this I’ve loop through the attachments and called email.GetAttachmentFilename(index) then I call email.SaveAllAttachments(directory).

The problem is that GetAttachmentFilename returns the TRUE filename of the attached file (i.e. superman.gif), whereas SaveAllAttachments (or SaveAttachedFile) saves the file as with a random string inserted into it (i.e. superman_3B0A.gif).

-          Can I get SaveAllAttachments (or SaveAttachedFile) to save the file without the random string inserted? 
-          Is there a method to get the filename SaveAttachedFile will use before SaveAttachedFile is called?

Answer:

If you call GetAttachmentFilename(index) after saving the attachments, the filenames returned will be the names of the files actually created. If a file of the same name already exists, the 4-character random sequence is added. There was a problem that was recently fixed in that the 4-character random sequence was always added. The fix, which is the current build (http://www.chilkatsoft.com/download/ChilkatDotNet.msi) makes it so that the filename is only modified when the file already exists.