Skip to Content
0
Former Member
Nov 20, 2009 at 11:42 PM

Error in rescheduling a report programatically

37 Views

Hi All,

I am trying to reschedule a report to use a new password using a c# program. But when I run the new schedule, the instance always shows "running" status. If I click on the status, I get the message "An error has occurred: The property with ID SI_NAME does not exist in the object" . Please find below the code snippet. Am I missing something?

IDE: VS 2005

Server : CRS 2008 V1

BOE SDK Version: 12.0.1100.0

What I am trying to do is

1. Find the recurring schedules in the Crystal Server

2. Load their parent reports

3. Reschedule the parent reports

4. Delete the old recurring schedule

Is there any other way to update the properties (like db password) on a recurring schedule?

=======================================================================

SessionMgr sessionMgr = new SessionMgr();

EnterpriseSession entSession = sessionMgr.Logon(lUid, lPwd, lServer, lAuth);

EnterpriseService entService = entSession.GetService("InfoStore");

InfoStore infoStore = new InfoStore(entService);

string query = "select SI_ID, SI_NAME, SI_PARENTID from ci_infoobjects where si_recurring = 1 and SI_NAME = 'TEST REPORT'";

InfoObjects infoObjs = infoStore.Query(query);

foreach (InfoObject infoObject in infoObjs)

{

//Get the si_id for the parent report

strParentID = infoObject.ParentID.ToString();

//Load the parent report object

string rptquery = "Select SI_NAME, SI_ID From CI_INFOOBJECTS Where SI_KIND='CrystalReport'And SI_ID =" + strParentID;

InfoObjects infoObjects = infoStore.Query(rptquery);

InfoObject infoObjectrpt = infoObjects[1];

Report report = (Report)infoObjectrpt;

SchedulingInfo schedulingInfo = report.SchedulingInfo;

schedulingInfo.Type = CeScheduleType.ceScheduleTypeDaily;

schedulingInfo.RightNow = false;

ReportFormatOptions rfo = report.ReportFormatOptions;

rfo.Format = CeReportFormat.ceFormatPDF;

ReportPrinterOptions reportPrinterOptions = report.ReportPrinterOptions;

reportPrinterOptions.Enabled = true;

reportPrinterOptions.Copies = 1;

reportPrinterOptions.FromPage = 1;

reportPrinterOptions.ToPage = 1;

infoStore.Schedule(infoObjects);

//Delete existing schedule

infoObject.DeleteNow();

infoStore.Commit(infoObjects);

}

infoStore.Dispose();

infoObjs.Dispose();

========================================================

Thanks

Ajith