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
James BillingsJames Billings 

Share via link - create in code?

Does anyone know if I can create a public share link for a file via code? 
I can do it via the Files UI, and I can then find this in the ContentDistribution object, but it still requires the user to have generated the link to begin with. 
Ideally I want to do this in code as part of a trigger. Any suggestions?
James BillingsJames Billings
Answering my own question - it appears that creating a new ContentDelivery record with PreferencesAllowOriginalDownload = true for my new ContentVersion generates the link on creation, so it was actually quite easy!