You need to sign in to do that
Don't have an account?
Sourav Hazra
MIME attachment - how to retrieve using apex
We are working on web service integraiton with salesforce where a document is getting transfered as a MIME attachment in the service. Is there any sample code available how to extract MIME attachment and display as document from salesforce?
You need to set the MIME Content-Type of the email attachment using the setContentType method. A registry of the top-level MIME Content-Types and their associated sub-types can be found at http://www.iana.org/assignments/media-types/media-types.xhtml, and one solution would be to get the extension, and then manually put the correct MIME Type (i.e. if ContentVersion.Filetype returns 'pdf', setContentType would need to recieve 'application/pdf')
Instead of having a bunch of conditionals, it would also be possible to work this out through custom settings. Apache keeps a mime.types file that has a list of extensions with their associated MIME type here: http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types. You could make a custom setting for the extensions and their related MIME Type, and then query the custom setting to retrieve the extensions MIME Type.
Please let me know if this helps
Best Regards
Naga kiran
I think it should work unless the attachment is too big.
Best regards
Naga kiran