Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm trying to insert a ContentVersion item as follows:

string before = 'Testing base 64 encode';
Blob beforeblob = Blob.valueOf(before);
ContentVersion v = new ContentVersion(Title='New Document',VersionData=beforeblob);
insert v;

But I'm getting the error:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, To create records with origin "C", Salesforce Content must be enabled in your organization and the Salesforce Content feature license must be enabled for your user. 

I tried this a Enterprise/Platform Org and a Platform Developer Org

Where do I enable this license for development in my org?

share|improve this question

1 Answer

up vote 3 down vote accepted

Is Salesforce Content Enabled?

App Setup > Customize > Salesforce CRM Content > Settings > Enable Salesforce CRM Content?

If so, does the user that is running this code have Salesforce CRM Content enabled on their user profile?

Screen Shot (cause I've got no rep!!) http://i.imgur.com/kjMss.png

A good resource for additional documentation is

http://na8.salesforce.com/help/doc/en/salesforce_content_implementation_guide.pdf

share|improve this answer
The post Salesforce.com Content in Developer Edition Org suggests setting user permissions after enabling CRM content. Admin Setup > Manage Users > Users > Edit User > Check Salesforce CRM Content User Checkbox – Daniel Ballinger Aug 19 '12 at 23:41
Thank you, that worked. I had check: Distribute the licenses to the new and existing users – jordan.baucke Aug 20 '12 at 2:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.