I would like to obtain a list of all SalesForce reports under all folders - the ones available by default (ex - All reports under Accounts and Contact Reports folder) and also the custom reports. At the moment I use the 'MetadataService.listMetadata' (generated from metadata.wsdl) method to obtain the report names but this gives me information only about custom reports. How do I get names of all the reports avaiable. Here is the existing code

 ListMetadataQuery query = new ListMetadataQuery();
 q.type = "ReportFolder";
 FileProperties[] fp = metadataService.listMetadata(new ListMetadataQuery[] { q }, 32);
 if (fp == null)
       return new string[0];

 List<string> reportFiles = new List<string>();
 q.type = "Report";
 foreach (MetadataService.FileProperties p in fp)
     q.folder = p.fullName;
     FileProperties[] rps = metadataService.listMetadata(new MetadataService.ListMetadataQuery[] { q }, 32);
      if (rps == null) continue;
      foreach (FileProperties rp in rps)

 return reportFiles.ToArray();

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.