+ Start a Discussion

Read the content of an attachment(attachment body) from an apex class


I am trying to read the content of an attachment from an apex class. 

 Attachment att=   [Select Id,a.ParentId, a.Name,a.body,a.ContentType From Attachment a where ParentId=:contactId limit 1];
           System.debug('Attachment body : '+ att.body);
        System.debug('Attachment body : '+ att.ContentType);

 the attachment body  content is displayed as :Blob[176680].
the body of the attachment is base64. I want to see the content of the body in plain english .

Any help is appreciated.