function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC_LearnerSFDC_Learner 

DML Operation on contentversion

Hi,

 

When i use the following query for deleting the contentversion stored files,

 

List<contentVersion> lstCV = [select id from contentversion];
system.debug('----->'+lstCV.size());
delete lstCV;

 

 

i got the below error.

 

line 3, column 1: DML operation DELETE not allowed on ContentVersion

 

 

Can any one please tell me, how can i delete the multiple records through a list from contentversion?

Navatar_DbSupNavatar_DbSup

Hi,

 

Yes you can't delete a version via the API.DML operation DELETE not allowed on ContentVersion.

Salesforce does not allow DML operation through API on the ContentVersion.

 

For more details refer to below Link:

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_contentversion.htm#sforce_api_objects_contentversion

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Itachi-sanItachi-san

Ah yeah, After all, that was really helpful for me :D

 

So if we want to delete a content we have to do it from ContentDocument and not ContentVersion

 

Thanks

SkiesnPiesSkiesnPies
Salesforce very unhelpfully changed all the URL's on the documentation so the links in historical documents no longer work (with no re-directs - a genius idea). If anyone has a new link......
mukesh guptamukesh gupta
Hi Learner,

Please check profile, means profile should have delete accesss and also check record owner.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh