on 05-23-2012 2:27 PM
Can somebody please tell me how to use set.ContentType in UDF?
I have to set the Content-Type of the email attachment in UDF but I am getting this error
I am using this function
GlobalContainer globalContainer = container.getGlobalContainer();
InputAttachments inputAttachments = globalContainer.getInputAttachments();
attachmentContent = new String(attachments.getContent()); | |
attachmentContent.setContentType("application/xml; charset=utf-8"); |
result.addValue(attachmentContent); |
Thanks,
Iqbal
Hi Muhammad,
At first your mistake is the next:
attachmentContent = new String(attachments.getContent()); --This means that attachmentContent has a String type
attachmentContent.setContentType("application/xml; charset=utf-8") --String doesn't have a method setContentype!!
Example:
// get the XI message from the environment
Message msg = (Message)
inputModuleData.getPrincipalData();
// create a new payload
TextPayload attachment = msg.createTextPayload();
// provide attributes and content for the new payload
attachment.setName("Attachment");
attachment.setContentType("text/plain");
attachment.setText("Hello World");
// add the new payload as attachment to the message
msg.addAttachment(attachment);
// provide the XI message for returning
inputModuleData.setPrincipalData(msg);
You can read these threads also:
http://scn.sap.com/thread/1946656
http://scn.sap.com/thread/1881560
This problem is the same that is in this other thread open by you http://scn.sap.com/thread/3180179, isn it?
Regards and good luck
Message was edited by: Iñaki Vila
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.