• #15829
    Salesforce | Mohit Mohit #319

    How can we get a sharing link from ‘files/content’ from Salesforce apex?

    Hi All,

    How can we get a sharing link from ‘files/content’ from Salesforce apex?

    Thanks in advance.


    Salesforce | Prakhar Prakhar #272

    Hi Mohit,

    According to your question, you want to get the sharing link of the document which is being saved in file object as a “Content Document”.

    In this case you can get the sharing link from “ContentDocumentLink” object which is a junction object between ContentDocument and file where it is shared of the content version of the document which is saved with the help of the query below:

    select id from ContentDocumentLink where ContentDocumentId = ‘(Id of the content document)’.

    For information about contentdocumentlink please click on the link.




    Use the ContentVersion-

    List<ContentVersion> listDoc = [select id, Title, Description from ContentVersion];


Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?