Newer Version Available
ContentDocumentLink
Represents the link between a Salesforce CRM Content document or Chatter file and where it's shared. This object is available in versions 21.0 and later for Salesforce CRM Content documents and Chatter files.
Supported Calls
create(), delete(), describeSObjects(), query(), retrieve(), update()
Special Access Rules
- Customer and Partner Portal users must have the “View Content in Portal” permission to query content in libraries where they have access.
-
Users (including users with
the “View All Data” permission) can only query files
they have access to, including:
- All Salesforce CRM Content files in libraries they're a member of and in their personal library, regardless of library permissions (API version 17.0 and later).
- All Chatter files they own, posted on their profile, posted on groups they can see, and shared directly with them (API version 21.0 and later).
- In API versions 33.0 and later, you can create and delete ContentDocumentLink objects with a LinkedEntityId of any record type that can be tracked in the feed, even if feed tracking is disabled for that record type. Chatter must be enabled for the organization.
- In API versions 25.0 and later, you can create ContentDocumentLink objects with a LinkedEntityId of type User, CollaborationGroup, or Organization.
- In API versions 21.0 and later, users with explicit Viewer access (the file has been directly shared with the user) to a file can delete ContentDocumentLink objects between the file and other users who have Viewer access. In the same API versions, any user with Viewer access to a file can deleteContentDocumentLink objects between the file and organizations or groups of which they are a member.
- For organizations with Communities enabled, a document can only be shared with users and groups that are a part of the community the file was created in.
Fields
| Field | Details |
|---|---|
| ContentDocumentId |
|
| LinkedEntityId |
|
| ShareType |
|
| Visibility |
The visibility of a ContentDocumentLink on a record post is derived from the highest level of visibility of the link on that record. |
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:
1SELECT 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.