Use this object to query the locations where a file is shared or query which files are linked to a particular location.

Usage

Use this object to query the locations where a file is shared or query which files are linked to a particular location. For example, the following query returns a particular document shared with a Chatter group:

SELECT ContentDocument.title FROM ContentDocumentLink
WHERE ContentDocumentId = '069D00000000so2' AND LinkedEntityId = '0D5000000089123'
  • You can't run a query without filters against ContentDocumentLink.
  • You can't filter on ContentDocument fields if you're filtering by ContentDocumentId. You can only filter on ContentDocument fields if you're filtering by LinkedEntityId.
  • You can't filter on the related object fields. For example, you can't filter on the properties of the account to which a file is linked. You can filter on the properties of the file, such as the title field.

A SOQL query must filter on one of Id, ContentDocumentId, or LinkedEntityId.

The ContentDocumentLink object supports triggers before and after these operations: insert, update, delete.

history | excerpt history