I am having a hard time downloading a contentversion/contentdocument where contentdocument is already archived.

I am trying to download the file by hitting rest endpoint


with Authorization header.

The response i got is

        "errorCode": "NOT_FOUND",
        "message": "The requested resource does not exist"

Unfortunately, I am not able to download the files. Is it possible to download archived content. The file needs to be sent to another non salesforce domain.

In my browser, If i directly go to contentversion url, https://**-ed.lightning.force.com/lightning/_classic/%2F068L0000000RgEvIAK then the file gets downloaded.

Edit: I can get the contentVersion by setting isArchived of contentdocument to false

ContentDocument doc= [select id,IsArchived from ContentDocument where IsArchived=false and id = '069L0000000RZb0IAG'  ALL ROWS];
ContentVersion cv = [SELECT Id FROM ContentVersion where contentdocumentId = :doc.id and islatest=true ALL ROWS];

But I do not want to set isArchived to false again as that would fail other logic.

Please help me in solving this problem.

  • Why can't you download the files? Can you be more specific? – sfdcfox May 16 at 15:42
  • Are you able to download non archived version? – Pranay Jaiswal May 16 at 15:47
  • I received, "errorCode": "NOT_FOUND", "message": "The requested resource does not exist" message. If I open the contentversion directly (https://**-ed.lightning.force.com/lightning/_classic/%2F068L0000000RgEvIAK/068L0000000RgEvIAK) in the domain, the file gets downloaded. (Updated question) Any way i can solve this problem. – lambad May 16 at 15:51
  • is that contentDocument attached to a record or in a library? – Pranay Jaiswal May 16 at 15:59
  • @sfdcfox, I have updated question. Can you plz help. – lambad May 16 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.