2

We are having trouble getting a "ContentDocumentLink" object back to a .net client via an authenticated API call. A similar call works fine for records from the "Attachment" object. The credentials used for the same user that uploaded the file. That user is the owner of the file.

Querying for the ContentDocumentLink with "LinkedEntityId = xyz" works successfully from the Developer Console query screen.

What could cause the owner of the ContentDocumentLink to not be able to get it via the API?

1
  • Is your API call using a different Salesforce User to the Developer Console query? Sep 29, 2016 at 18:11

2 Answers 2

0

There are a number of Special Access Rules listed for ContentDocumentLink.

These seem applicable here:

  • 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 Salesforce Files they own, posted on their profile, posted on groups they can see, and shared directly with them (API version 21.0 and later).

If the query works from the developer console it should also work via the API with a session for the same user. Can the querying user also access the record identified in the LinkedEntityId?

3
  • Hi Daniel. The developer working on this reported success with the API query after enabling Chatter for the user. But, I didn't see that listed as a specific/explicit requirement in the SFDC documentation. Would that feature naturally overlap with the requirements you listed above?
    – SeanW
    Sep 30, 2016 at 13:36
  • @SeanW Was the LinkedEntityId associated with Chatter? Sep 30, 2016 at 19:13
  • No, the LinkedEntityId points to an arbitrary custom __c object. This link describes using a custom object with a ContentDocumentLink, and it emphasizes that Chatter must be enabled. So, maybe that is an undocumented requirement... sundoginteractive.com/blog/…
    – SeanW
    Oct 3, 2016 at 20:12
0

I'm proposing that the obligation to enable Chatter was the answer to my problem: This link describes using a custom object with a ContentDocumentLink, and it emphasizes that Chatter must be enabled. So, maybe that is an undocumented requirement... https://www.sundoginteractive.com/blog/4-keys-to-working-with-chatter-files-and-a-portal

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .