Attaching a ContentDocument to a Salesforce Custom Object

The Salesforce ODBC Driver enables you to work with Salesforce by using SQL (and since version 2.0 of the driver, SOQL as well).

After you have downloaded, installed and licensed the Salesforce ODBC driver (see the driver documentation), you need to set up an ODBC data source where you specify your Salesforce user name and password. You're then ready to enter some SQL in your ODBC application.

To address the subject of this blog, which was based on a customer request, this SQL statement:

insert into ContentDocumentLink (LinkedEntityId, ContentDocumentId, ShareType)
Values('a000H00000sWZ9AQAW', '0690H000004bVnOQAU', 'V')

adds the specified custom object to the ContentDocument's Shared With list in the Salesforce backend GUI, where:

The ShareType can also be C (Collaborator) or I (Inferred). However, during testing "I" didn't work for us. We got an "access denied" error, which is strange since we only use one user, a system administrator, to do everything in Salesforce.