Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
C#.NET
//Retrieve the report to be deleted
ceReportObjects = ceInfoStore.Query("SELECT SI_ID FROM " +
"CI_INFOOBJECTS WHERE " +
"SI_PROGID = 'CrystalEnterprise.Report' " +
"AND SI_ID=" + rp.ExternalId);
C#.NET
public static string CreateReport(string ParentFolderID, string reportFile,ReportProfile rp)
{
string confirmedUpload = "";
try
{
//Enterprise variables
EnterpriseSession ceSession = getEnterpriseSession(rp.ReportServer);
InfoStore ceInfoStore;
EnterpriseService ceEnterpriseService;
ceEnterpriseService = ceSession.GetService("", "InfoStore");
ceInfoStore = new InfoStore(ceEnterpriseService);
CrystalDecisions.Enterprise.Desktop.Report ceReport;
InfoObjects newCollection;
InfoObject newReport;
PluginManager cePluginMgr;
PluginInfo ceReportPlugin;
//retrieve the plugin manager for reports
cePluginMgr = ceInfoStore.PluginManager;
ceReportPlugin = cePluginMgr.GetPlugins("Desktop")["CrystalEnterprise.Report"];
//add a new report object to the reports collection
newCollection = ceInfoStore.NewInfoObjectCollection();
newReport = newCollection.Add(ceReportPlugin);
//Set the new report to the report object
newReport.Files.Add(reportFile,1);
//Set the properties of the ID of the folder to add the report in
newReport.Properties.Add("SI_PARENTID", (string)ParentFolderID);
ceReport = new CrystalDecisions.Enterprise.Desktop.Report(newReport.PluginInterface);
ceReport.EnableThumbnail = true;
//commit the report to the InfoStore
ceInfoStore.Commit(newCollection);
confirmedUpload = "Report successfully added";
rp.ExternalId = newReport.ID.ToString();
rp.Name = newReport.Title.ToString();
if (System.Convert.IsDBNull(newReport.Description.ToString()))
{
rp.Description = newReport.Description.ToString();
}
else
{
if (newReport.Description.Length > 0)
{
if (newReport.Description.Length >= 300) //300 Char max field in database
{
//truncate description to 296 characters and append '...' to the end.
rp.Description = newReport.Description.ToString().Substring(0,296) + "...";
}
else
{
rp.Description = newReport.Description.ToString();
}
}
else
{
//If no description, use Report Title with
//'Crystal Report' appended at end
rp.Description = rp.Name + " Crystal Report";
}
}
rp.TreeViewEnabled = false;
rp.Enabled = false;
ceSession.Logoff();
return confirmedUpload;
}
catch (Exception err )
{
confirmedUpload = err.Message.ToString();
return confirmedUpload;
}
}