Find your content:

Search form

You are here

How to Control Content Delivery Setting in Apex Program?

 
Share

I want to control Content Delivery Option in Programmatic way. so does salesforce provides any api to access this functionality. Also We can control it mannualy by, Admin | Setup | customize | Content Delivery but want to know in programmatic way


Attribution to: Axaykumar

Possible Suggestion/Solution #1

As of winter 15 this is now possible:

ContentDistribution cd = new ContentDistribution();
cd.name = 'test';
cd.ContentVersionId = '12312132abad';
cd.PreferencesAllowOriginalDownload = false;
cd.PreferencesAllowPDFDownload = false;
cd.PreferencesAllowViewInBrowser = true;
insert cd;

cd = [SELECT DistributionPublicUrl FROM ContentDistribution WHERE ID = :cd.Id];
System.debug(cd.DistributionPublicUrl);

You can basically do anything you can do in the native UI. Add password, set expiration, allow download, etc. I can't find any official documentation yet, but you can explore the properties using the workbench. Just make sure your API version is set to 32.

screenshot ContentDistribution Object in workbench


Attribution to: NSjonas

Possible Suggestion/Solution #2

I haven't tried this yet, but perhaps this could help.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentworkspacedoc.htm


Attribution to: Quade

Possible Suggestion/Solution #3

I don't believe you can do this via Apex. I searched long and hard for this a while back when a customer had some automation requirements, but I couldn't find an sobject that contains the content delivery information.


Attribution to: Bob Buzzard
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1002

My Block Status

My Block Content