I have some Apex code that inserts a
ContentNote and the corresponding
ContentDocumentLink. This works fine and the data can be viewed through the normal Salesforce UI.
But some further code that updates the content (in a separate transaction) fails with this DmlException:
Unable to create/update fields: VersionData. Please check the security settings of this field and verify that it is read/write for your profile or permission set.
VersionData is a field in the underlying ContentVersion object and the Content objects are not surfaced (as far as I can see) in profiles. So I presume this is being caused by something else.
I'm inserting the
ContentDocumentLink with these settings:
cdl.put('ShareType', 'I'); cdl.put('Visibility', 'AllUsers');
Any idea how to stop this error from happening?