Loading

System administrator cannot export all Content via Data Loader

Publiceringsdatum: Oct 13, 2022
Beskrivning


A common option used to export all Content is via the Data Export Service, although this will not be always an option. Solutions via AppExchange are available to help customer with these particular requirements where the Data Export Service is not possible.

One workaround that can be employed is to have all "Content Files" shared to the user performing the export in this case the System Administrator. 
 

Lösning

Ways to share Content Files:
 
1. This can be done by the Content File owner in the UI by going to the File Detail Page and clicking on Sharing Settings and selecting the user where file needs to be shared with. More detailed information is available in Share Files with People in Salesforce Classic.


2. Above solution may not be always ideal specially when dealing with many files. An option is to use Data Loader to share the files to a particular user. Since you cannot use the Content Document Object to get the ID's, you will need to use another object to get the ContentDocumentID's.

Steps to follow:
a. In Data Loader, run an export operation on the ContentDocumentLink object. Make sure to include the ContentDocumentID field in your export.

Note: You will need to ensure that you are using a filter for a single LinkedEntityId or ContentDocumentId. If you are exporting Content Files from multiple records, you can use the sample SOQL Query in Data Loader below: 
 
Select Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN ('ExampleSalesforceID','ExampleSalesforceID')
 
b. Using the file you get from step a, you will only need the ContentDocumentID column. You may have duplicate ID's here since Files could be shared to multiple records/users. You can keep the file as is or remove the duplicates in the CSV file.

c. Once you have cleaned up the file above, prepare it for the "ContentDocumentLink" insert operation by adding the following Column Headers: LinkededEntityId and ShareType.

Values for the new Column Headers would be

*LinkededEntityId = UserID where you want the files to be shared
*Sharetype =

V
Viewer permission. The user can explicitly view but not edit the shared file.

C
Collaborator permission. The user can explicitly view and edit the shared file.

I
Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined by the permissions the user has in that library.


d. Using Data Loader, run an "Import" operation using the "ContentDocumentLink" Object.


Once the import is a success, the user where the Content Files were shared to will now be able to export all ContentDocuments with no problem via API and perform operations based on the "Sharetype" that was set.


Additional resource:
Query All Files
Knowledge-artikelnummer

000382063

 
Laddar
Salesforce Help | Article