检索以pdf格式发送的计划和/或完成的Crystal报告的电子邮件地址和参数
我正在计划将我的应用程序中的Crystal报表计划到电子邮件队列中的Crystal Reports Server.我想以pdf格式发送报告.发送电子邮件工作正常.在CMS(Crystal Reports服务器)中,我可以查看历史记录和计划的报告及其参数.
我想在我的应用程序中检索参数和已使用的电子邮件地址,以获取完整的报告(历史记录)和计划的报告.
如果检索历史记录,则将信息对象安排为报告",但是当我从历史记录中检索它们时,它们似乎不是对象类型Report,而是类型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";
dt.Columns.Add("Naam");
dt.Columns.Add("Weetniet");
dt.Columns.Add("Eigenaar");
dt.Columns.Add("Status");
dt.Columns.Add("");
dt.Columns.Add("");
InfoObjects infoObjects = infoStore.Query(query);
foreach (InfoObject infoObject in infoObjects)
{
try
{
Report report = (Report)infoObject;
dt.Rows.Add(
infoObject.Title,
infoObject.Properties["SI_NAME"],
infoObject.Properties["SI_OWNER"],
infoObject.SchedulingInfo.Status,
(CeScheduleType)infoObject.SchedulingInfo.Type,
infoObject.Properties["SI_STATUSINFO"]
);
}
catch (Exception e)
{
Alert.Show("Fout in opvragen geschiedenis\n" + e);
}
}
引发异常:
无法将类型为"CrystalDecisions.Enterprise.Desktop.Pdf"的对象转换为类型为"CrystalDecisions.Enterprise.Desktop.Report"的对象.
对于Pdf对象,我找不到属性来查找电子邮件地址和参数.由于我可以在CMS中看到它们,因此它们必须在某处...
有人知道怎么做吗?
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?
自己找到了.您需要获取父报表(原始水晶报表)的属性.
因此,首先选择父级SI_ID:
Found it myself. You need to get the properties of the parent report, which is the original crystal report.
So first select the parent SI_ID:
getParameters(infoObject.ParentID.ToString());
这是获取参数的过程:
Here is the procedure to get the params:
private string getParameters(string objectID)
{
string query = "Select * FROM CI_INFOOBJECTS WHERE SI_ID = " + objectID;
string result = "";
InfoObjects infoObjects = infoStore.Query(query);
Report report = (Report)infoObjects[1];
ReportParameters reportParameters = report.ReportParameters;
for (int i = 1; i <= reportParameters.Count; i++)
{
ReportParameter reportParameter = reportParameters[i];
result += reportParameter.ValueDisplayString;
}
return result;
}