In the following test method:
static testMethod void testEmailWithAttachments() {
ContentVersion contentVersion = new ContentVersion();
contentVersion.FileType = 'Text';
contentVersion.VersionData = Blob.valueOf('Some Text');
contentVersion.Title = 'Test';
insert contentVersion;
}
I receive:
Field is not writeable: ContentVersion.FileType
Please advise how to avoid Field is not writeable: ContentVersion.FileType
and make the insert in my test method?
Best Answer
FileType
isn't writeable, butPathOnClient
is - it's createable, but not updateable. The system will infer the type of file from the pathname extension you supply in that field. (ContentNote
records will have typeSNOTE
; they don't have extensions).See the SOAP Reference: