I am trying to query for all the documents in a library using the BULK API. The SOQL query I use is

SELECT ContentDocument.Id,ContentDocument.CreatedDate,ContentDocument.LastModifiedDate,ContentDocument.IsDeleted,ContentDocument.SystemModstamp,ContentDocument.Title,ContentWorkspace.Name 
FROM ContentWorkspaceDoc

This will give me all the information for the latest version of each document. When I execute this query via the BULK API I get an error -

'InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Foreign Key Relationships not supported in Bulk Query'

What should SOQL query (usable with the BULK API) be for fetching document from a content library?

  • What if you'll try to cheat? SELECT Id,CreatedDate,LastModifiedDate,IsDeleted,SystemModstamp,Title FROM ContentDocument WHERE Id IN (SELECT ContentDocumentId FROM ContentWorkspaceDoc WHERE ContentWorkspace.Name = 'Salesforce.com Training')?
    – eyescream
    Commented Dec 22, 2013 at 18:57

1 Answer 1


It seems SOQL queries with relationships are not supported in Bulk API.

There is an idea posted here

  • Ya, I did read that but was wondering if there is another query/way to achieve what I want Commented Oct 23, 2013 at 14:43

You must log in to answer this question.

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