I have a requirements that I need to share files with particular user which belongs to partner community user through trigger/apex code. I am using the below hard to test. But finding some issue.
ContentDocumentLink cdl = new ContentDocumentLink(); cdl.ContentDocumentId = '0690q000000oiuNAAQ'; cdl.ShareType = 'V'; cdl.Visibility = 'AllUsers'; cdl.LinkedEntityId = '0050q000002iRF1'; insert cdl;
Error:EXCEPTION: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: [LinkedEntityId]
Please help in this!