How to access properties SI_SCHEDULEINFO.SI_DESTINATION

Wondering if someone can help me figure out how to extract the email addresses that a scheduled report will be sent to.

I begin by querying for the schedule info from a given report:


String query = "Select SI_SCHEDULEINFO From CI_INFOOBJECTS Where SI_ID = " + reportID;

from the returned IInfoObject I get the scheduling info:


ISchedulingInfo sched = obj.getSchedulingInfo();

from that I get the destination info:


IDestination dest = sched.getDestination();

now from this, I want to find all the email addresses but not sure how.
the following does not work:


for (int i = 1; i <= (Integer)dest.properties().getProperty("SI_DEST_SCHEDULEOPTIONS.SI_MAIL_ADDRESSES.SI_TOTAL").getValue(); i++) {
    						String address = dest.properties().getProperty("SI_DEST_SCHEDULEOPTIONS.SI_MAIL_ADDRESSES." + String.valueOf(i)).getValue().toString();
    					}

Any ideas or exmaples on how to iterate over the destination property bag?

Thanks!


Andrew Jones :canada: (BOB member since 2010-03-10)

Here’s a snippet of how we retrieve email addresses from schedules.

hope it helps.


String query ="Select *  from CI_INFOOBJECTS WHERE " +
"SI_NAME=" + "'" + reportNameSv + "'"+ 
" and  SI_RECURRING='1' ";


try{
results = (IInfoObjects) iStore.query(query);
if(results.size()>0){
report = (IInfoObject) results.get(0);
//				out.println("Report Name: " + report.getTitle() + "<BR>");
sched = report.getSchedulingInfo();
destination = sched.getDestination();
destPlugin = (IDestinationPlugin) iStore.query("select * " +
"from ci_systemobjects where si_parentId=29 and si_name='CrystalEnterprise.SMTP' ").get(0);
destination.copyToPlugin(destPlugin);
if(destPlugin==null) {
out.println("Unable to get DestPlugin");

}else{
smtpOptions = (ISMTPOptions) destPlugin.getScheduleOptions();

String s = smtpOptions.getToAddresses().toString();
String emailSender = smtpOptions.getSenderAddress().toString();
s = s.replace(',',';');
s = s.replace('[',' ');
s = s.replace(']',' ');
s = s.trim();
String x = smtpOptions.getMessage() ;
if(hasSpecialChar){
reportName = reportNameSv;
x = x.replace('^','$');


}
out.println("Message: " + x + "<BR>");

out.println("Showing Message Body" + smtpOptions.getMessage() + "<BR>");
out.println("Showing To Addresses" + smtpOptions.getToAddresses() + "<BR>");

}
//out.println(destPlugin);

}
else{
out.println(reportName);
out.println("No results found");
}
}catch(Exception e){
out.println(reportName);
out.println("Error found " + e.getMessage());
}


jresendez :mexico: (BOB member since 2004-05-03)

Awesome, thanks!!

question, in :


select * from ci_systemobjects where si_parentId=29 and si_name='CrystalEnterprise.SMTP' 

is that hard-coded value ‘29’ the id of your report or something else??


Andrew Jones :canada: (BOB member since 2010-03-10)

after a few queries via the query builder i believe i know why si_parentid=29 is specified.

I executed the following:

select * from ci_systemobjects where si_id=29

this returned one record of SI_KIND=‘FOLDER’ and the SI_NAME for that folder was ‘Destination Plugins’ (this already starts to make sense) :+1:
the record also indicated that it has an SI_CHILDREN value of 4

I retrieved the 4 children by the following:

select si_kind,si_name from ci_systemobjects where si_parentid=29

The children had SI_Names as follows:
[list]CrystalEnterprise.Smtp[/list]
[list]CrystalEnterprise.Managed[/list]
[list]CrystalEnterprise.Ftp[/list]
[list]CrystalEnterprise.DiskUnmanaged[/list]

so the additional criteria of ‘CrystalEnterprise.Smtp’ limits the original query to retrieving only the plugin information for the SMTP destination plugin.


jresendez :mexico: (BOB member since 2004-05-03)

Ahha, good stuff!

That explains a lot. Thanks for the help and info :slight_smile:


Andrew Jones :canada: (BOB member since 2010-03-10)

[Moderator Note: Moving from XI Scheduler forum to SDK]


Marek Chladny :slovakia: (BOB member since 2003-11-27)