I need to be able to retrieve a list of Documents using the Metadata API.

According to the documentation, "To retrieve the list of documents for populating package.xml with explicit names, call listMetadata() and pass in DocumentFolder as the type." Contrary to this sentence, this call returns a list of DocumentFolders, not Documents, which makes sense since we asked for a list of DocumentFolders.

I have the exact use case described by the docs, which is I need to "retrieve the list of documents for populating package.xml with explicit names." So, how do I get actual Document names?

1 Answer 1


This looks to be an error in this part of the documentation, what you actually need to do is set the Folder in the ListMetadataQuery parameter, leaving the Type set to Document.

The folder associated with the component. This field is required for components that use folders, such as Dashboard, Document, EmailTemplate, or Report.

ListMetadataQuery query = new ListMetadataQuery();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.