Retrieve parameters from scheduled reports as pdf
I'm planning Crystal reports from my application to Crystal Reports Server in the email queue. I want to sent the reports as pdf. Sending emails works fine. In the CMS (Crystal Reports Server) I can see the history and scheduled reports with their parameters.
I would like to retrieve the parameters and used email addresses in my application for completed reports (history) and scheduled reports.
If I retrieve the history, the infoObjects that are scheduled as "Report", but when I retrieve them from the history it appears they are not object type Report but type Pdf:
string query = "Select SI_ID, SI_NAME, SI_OWNER, SI_DESCRIPTION, SI_STATUS, SI_STATUSINFO " +
",SI_RECURRING, SI_SCHEDULEINFO.SI_OUTCOME " +
"FROM CI_INFOOBJECTS " +
"WHERE SI_KIND='CrystalReport' AND SI_RECURRING=0";
InfoObjects infoObjects = infoStore.Query(query);
foreach (InfoObject infoObject in infoObjects)
Report report = (Report)infoObject;
catch (Exception e)
Alert.Show("Fout in opvragen geschiedenis\n" + e);
The instruction "Report report = (Report)infoObject;" throws the exception:
Unable to cast object of type 'CrystalDecisions.Enterprise.Desktop.Pdf' to type 'CrystalDecisions.Enterprise.Desktop.Report'.
For the Pdf Object I cannot find the properties to find the email addresses and parameters. Since I can see these in the CMS, they must be there somewhere...
Does anyone know how to do this?
Aasavari Bhave replied
you cannot cast report instance of pdf type to Report interface object. For PDF instances, just get the
SI_SCHEDULEINFO.SI_DESTINATIONS and SI_PARAMS property bag of the InfoObject of pdf type and go throught the property bag properties to retrieve destination or parameter information.
If you query for the pdf instance using query builder you can check the structure of those property bags.