Archived Forum Post

Index of archived forum posts

Question:

Help with Attachments and RelatedItems...

Jan 05 '13 at 12:44

We read emails individually via POP3 and IMAP. Ran into an issue of not getting the imbedded images within the message because the standard Chilkat "attachment" commands like SaveAllAttachments doesn't process those.

The only way I can figure out how to "save" those is to cycle through them with GetRelatedFilename followed by SaveRelatedItem commands.

Is that the ONLY way to do that?

Once we save the attachments and relateditems, with the OverWrite flag True, do we have to use both GetAttachmentFilename and GetRelatedFilename (again) to get the new unique filename?

Finally, does the "save to directory" have to be created when saving these or will it automatically create it if it doesn't exist.

Thanks for any help....

Once we have them "saved", either regular attachments or RelatedItems... can we use a single


Answer

1) Yes. Unfortunately, there is no SaveAllRelatedItems method. You would need to write a very small loop (a few lines of code) to iterate from 0 to NumRelatedItems-1 to call SaveRelatedItem for each.

2) If the OverwriteExisting property is True, then the name of the attachment or related item won't change when saving -- because if the file already exists it will be overwritten. If the OverwriteExisting property is False, then the filename may change if the file already exists in the filesystem, and you may get the actual filename afterwards via the GetAttachmentFilename/GetRelatedFilename methods.

3) The directory path is automatically created if it does not exist.