Apex Data Loader Tips for Uploading Content Files

Salesforce.com Content is a pretty good document management system.  If you are using Salesforce and you aren’t using Content you probably should.

Uploading large quantities of files is not difficult, but requires some local knowledge.  Here are a few tips to make it easier.

  1. Give the Apex Data Loader more heap space.  Instructions can be found here.
  2. I like to err on the side of reliability when doing document uploads; so I change the Data Loader Settings to use a batch size of 1 and do not use the Bulk API.
  3. Keep in mind that you can only import 5,000 files per day.  If you are doing more than this, open a case with Salesforce.com support and get the limit raised temporarily.
  4. Files in Content are managed by 2 objects.  ContentDocument and ContentVersion.  When uploading new documents to Content, you are adding records to ContentVersion.  When you are bulk deleting, you delete records from ContentDocument.
  5. The easiest way to figure out how to create a ContentVersion upload file is to first do an Export.  Make sure to manually add a few files to Content through the UI so there is something to Export from each of the Libraries you want to populate.  When doing the ContentVersion Export, select ALL columns EXCEPT VersionData.  VersionData contains the actual bytes of the files in Content.
  6. The minimum set of columns required for a Content import are:
  • TITLE = User friendly name of the file, can be anything, but usually the filename without any folder (path) information.
  • PATHONCLIENT = Fully qualified file name including ALL path information.
  • VERSIONDATA = exactly the same as PATHONCLIENT.
  • FIRSTPUBLISHLOCATIONID = Salesforce ID of the Library where the document should be loaded.  If you don’t put this in the file, then your files will be uploaded to your personal library which must be wrong.

That should get you started. Have fun assembling your files into batches for uploading.  Once they are in Content, you’ll get the benefit of secure sharing, preview of popular file types, and flexible tagging.