* You are viewing Posts Tagged ‘boxi sdk’

Scheduling Webi with prompts on BO XI R2 in C#

This is a complete and working solution to scheduling a Webi with prompts for Business Objects XI R2 SDK.

SessionMgr oSessionMgr = new SessionMgr();
EnterpriseSession oEnterpriseSession = oSessionMgr.Logon(“user”, “pass”, “cmsname”, “secEnterprise”);
EnterpriseService oEnterpriseService = oEnterpriseSession.GetService(“InfoStore”);
InfoStore oInfoStore = new InfoStore(oEnterpriseService);
Smtp smtp = (Smtp) oInfoStore.Query(“Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS Where SI_PARENTID=29  And SI_NAME=’CrystalEnterprise.Smtp’”)[1];
int iMinuteNumber = 1;
int iLogonNumber = -1;
string strToken = oEnterpriseSession.LogonTokenMgr.CreateWCAToken(“”,iMinuteNumber, iLogonNumber);
ReportEngines repEngines = new ReportEngines(strToken);
IReportEngine oReportEngine = repEngines.getService(ReportEngineType.WI_ReportEngine);

InfoObjects ios = oInfoStore.Query(String.Format(“Select * From CI_INFOOBJECTS Where SI_NAME = ‘{0}’ and SI_INSTANCE = ‘false’”, name));
if (io is Webi){
{
Webi webi = (Webi)io;
Webi webi_nu = new Webi(webi.PluginInterface);
webi_nu.SchedulingInfo.RightNow = true;
DestinationOptions destinationOptions = smtp.ScheduleOptions;
SmtpOptions smtpOptions = new SmtpOptions(destinationOptions);
//Setting of SMTP options subject, CC, TO, FROM, etc…
webi_nu.WebiFormatOptions.Format = CeWebiFormat.ceWebiFormatPDF;
smtpOptions.Attachments.Add(“application/pdf”, “%SI_NAME% %SI_STARTTIME%.%EXT%”);

IDocumentInstance ins = oReportEngine.OpenDocument(webi.ID);
ins.Refresh();
ReportParameterUtility.PopulateWebiPrompts(ins.GetPrompts(), webi_nu);
int idx = 0;
foreach (WebiPrompt o in webi_nu.Prompts)
{
o.Values.Clear();
foreach (string c in PARAMS[idx])
{
o.Values.Add(c);
}
idx++;
}
webi_nu.SchedulingInfo.Destination.SetFromPlugin(smtp);
oInfoStore.Schedule(ios);
}

Enjoy!


http://blog.javarnd.com/wp-content/plugins/sociofluid/images/digg_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/reddit_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/dzone_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/stumbleupon_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/delicious_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/blinklist_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/blogmarks_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/furl_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/newsvine_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/technorati_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/magnolia_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/google_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/facebook_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/twitter_24.png
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.00 out of 5)
Loading ... Loading ...