+ Start a Discussion
JWikkJWikk 

insufficient access when creating contentdocumentlink

I am succesfully creating contentversion through the SOAP API, but when creating a contentdocument link (that links my document to another object record) I get an error: INSUFFICIENT_ACCESS_OR_READONLY

What access does the authenticated user need for proper access? Is it to do with the object I am linking the content file to? If so, what permission is needed?
Best Answer chosen by JWikk
GauravGargGauravGarg
Hi JW,

ContentDocument / ContentDocumentLink objects inherit permissions from the parent object. Please look below link for reference:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm

The user must have these two permissions:
  • The user is the current owner, or has either the “Modify All Data” or "Manage Salesforce CRM Content” permission enabled.
  • The user has the “Manage Library” permission enabled for the library containing the document.
Hope you find the document useful, contact me if you need more info on this. 

THanks,
Gaurav
Skype: gaurav62990

All Answers

GauravGargGauravGarg
Hi JW,

ContentDocument / ContentDocumentLink objects inherit permissions from the parent object. Please look below link for reference:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm

The user must have these two permissions:
  • The user is the current owner, or has either the “Modify All Data” or "Manage Salesforce CRM Content” permission enabled.
  • The user has the “Manage Library” permission enabled for the library containing the document.
Hope you find the document useful, contact me if you need more info on this. 

THanks,
Gaurav
Skype: gaurav62990
This was selected as the best answer
JWikkJWikk
So the amount of permissions is more than just creating attachments. Attachments just needed CRUD
GauravGargGauravGarg
Yes, these are another objects and that inherit permission from the Parent object just like Attachments. 

Thanks,
Gaurav
JWikkJWikk
Turns out that we were not setting visibility. We tried various combinations with sharetype 'I' but none worked. The only combo that worked through the API was visibility = 'AllUsers' and Visibility = 'V'.

Looking at the file in SF, it says that the file is Privately Shared.

We are doing further tests to ensure that this works for non-sys admin users also.
varun gupta 70varun gupta 70
hi @GauravGarg,

Could you please let me know where can we find these two permissions.

Thanks,
Varun Gupta
Nikolajs Mitjuls 11Nikolajs Mitjuls 11
Hi @varun gupta 70,
"Manage Salesforce CRM Content" is in 'App Permissions' and "Modify All Data" is in 'System Permissions' on Profiles which could be found in Setup -> Name of Profile