Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4643 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Part of a solution is email based (using 360Works Email Plugin) and the system downloads email records and saves the attachments to SuperContainer for later retrieval. The SuperContainer folder structure is as follows: "/SuperContainer/Files/EmailFiles/MessageID/files" where MessageID is a numerical record ID from the message itself and the files are the attachments associated with that email message.

The attachment pointer records are in a related table. The attachments are stored, one per record, into a temporary container field and then uploaded to SuperContainer using SCSetContainer.

The problem is that if a message has 2 attachments the 2nd one overwrites the MessageID folder so that only the 2nd attachment remains.

Any thoughts?

Here are the SCSetBaseURL & SCSetContainer script steps that I'm using:


SCSetBaseURL("http://serverAddress:8020/SuperContainer/Files" ; "username" ; "password" )







SCSetContainer(

"EmailFiles/" & EmailAttachments::__kf_messageID ;

EmailAttachments::File|Temp ;

"filename=" & EmailAttachments::File|Name ;

"showProgress=false"

)

Posted

Have you confirmed the first attachment is being saved correctly (with SCLastError or checking the actual SuperContainer save location)? Or tried adding a slight pause between setting the SCSetContainer uploads.

Posted

Yes, I have confirmed it. I added a 10 second pause and was able to confirm that the 1st file is uploaded. It then disappears when the 2nd file is written, and so forth. The SC log confirms that each file is uploaded as well.

Posted

Hey Kevin,

It seems like your field:

EmailAttachments::__kf_messageID;
 will always result to the same folder (I am assuming that if the id is based off a foreign key, it will resolve to the same ID (let's say, "45028") for each record). So, given a record that contains two attachments, both attachments would be placed in folder "45028"...



Here's an example of what happens in SuperContainer...



First attachment is found:




SCSetContainer(

"EmailFiles/" & EmailAttachments::__kf_messageID ;

EmailAttachements::File|Temp ;

"filename=" & EmailAttachments::File|Name ;

"showProgress=false"

)




* where "EmailAttachments::__kf_messageID" = 45028 and

* filename = "myAttachment0.rtf"



Attachment is saved in location:




/Users/shared/SuperContainer/Files/EmailFiles/45028/myAttachment0.rtf 




Next call to SCSetContainer() when encountering second attachment (myAttachment1.rft):



Because SuperContainer only places a SINGLE file in a SINGLE directory (overwriting otherwise), the newly encountered attachment is saved in location:




/Users/shared/SuperContainer/Files/EmailFiles/45028/myAttachment1.rtf




Your SuperContainer log should display a message similar to:


"Uploaded new file: /Users/Shared/SuperContainer/Files/EmailFiles/45028/myAttachment0.rtf (32,738 bytes)

 Uploaded new file: /Users/Shared/SuperContainer/Files/EmailFiles/45028/myAttachment1.rtf (2,852 bytes)"




My suggestion is to make sure that you are uploading to two separate folders using the SCSetContainer() function. Perhaps you could increment an "attachmentNum" field that would create a new folder to upload to per attachment:




"/EmailFiles/" & EmailAttachment::__kf_messageID & "/" & EmailAttachment::attachmentNum




* where "attachmentNum" is 1 for the first attachment, 2 for the second, 3 for the third,... and is incremented every time it encounters an attachment per that record.



This would make your resulting uploads look similar to:




"Uploaded new file: /Users/Shared/SuperContainer/Files/EmailFiles/45028/1/myAttachment0.rtf (32,738 bytes)

 Uploaded new file: /Users/Shared/SuperContainer/Files/EmailFiles/45028/2/myAttachment1.rtf (2,852 bytes)"

I hope this helps. For additional examples on how to use related tables and SuperContainer, take a peek at this sample database.

Good luck,

This topic is 4643 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.