2

Can someone help me understand why I would get this error? My understanding is that I should be able to insert a new ContentDelivery by using similar code:

ContentDistribution cd = new ContentDistribution();
cd.name = 'test';
cd.ContentVersionId = '1234567891011AA'; - using real Id
cd.PreferencesAllowOriginalDownload = false;
cd.PreferencesAllowPDFDownload = false;
cd.PreferencesAllowViewInBrowser = true;
insert cd;

Deliveries are enabled and I am a system admin attempting to run this code from an Anonymous block in a Sandbox.

2 Answers 2

1

Apparently I was using the Document Id and not the Version Id! Boy do I feel stupid!

0
0

It appears to me that you're trying to insert Content. If so, then you need to use the ContentVersion object. That would be the cross reference Id that the error is referring to.

From the documentation:

To update a Salesforce CRM Content document, the user must be a member of the library with one of these library privileges enabled:

  • “Add Content”
  • “Add Content On Behalf of Others”
  • “Manage Library”
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .