You need to sign in to do that
Don't have an account?

Using metadata api to retrieve a list of all reports
All,
I can not figure out how to retrieve a list of all reports from the metadata API and must be missing something simple. If I setup a ListMetadataQuery and just set the type to "Report" I get nothing in return. If I set the folder to null or "" I still get nothing in return. If I set the Type to "Report" and set the folder to a folder with in the org then I get all the reports from that folder, which is expected. What I need to know is, is there a way to get a list of folders for reports? Or is there a way to list all the reports regardless of folder? Thanks in advance for any help.
I guess the easiest way of asking this is for the ListMetadataQuery, does the method setFolder have a wildcard character that will return any result from any folder? I tried "*" and it didn't work
You have to specify a folder when querying an object that uses folders (http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_listmetadataquery.htm). The correct method, then, is to query for a list of folders (http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_folder.htm?SearchType=Stem&Highlight=folders|folder|Folder|Folders) using retrieve() against the Folder object (which supports the wildcard *).
Actually found an easier way to avoid running the retrieve. You can run the listmetadata on ReportFolder and get a list of report folders. Tacking the Folder ending on to any type that requires a folder will do the same with the exception of emailtemplates. The folder type for that is just emailfolder. Gotta love coding around those one of exceptions of the metadata api
Like Max suggested, listMetadata works well for describing the 4 folders. It works too for Email Template, but you need to specify EmailFolder (and not EmailTemplateFolder) ... You probably want to hardcode these values unfortunately since "describeMetadata" doesn't even provide any tip on how to name them (describeMetadata provides however information that these metadata are folders metadata).
https://glazeforce.wordpress.com/2016/02/03/get-all-reports-along-with-their-folder-name-and-report-data/
Hope this helps!!
Thanks