cancel
Showing results for 
Search instead for 
Did you mean: 

Publication Attributes

Former Member
0 Kudos

Hi All,

I am I am trying to undersnad attributes of Publication, I have some automated Publications which runs from JAVA/.NET code. I pass the ID to the prompt and then the publication runs and dynamic participants recieve the PDF/Excel on FTP and Sharepoint.

I need to make the destination dynamic, like on onlyy some conditions the output to go to FTP, or Sharepoint , or both, the logic can be written in the code easily.

I want to know the class, atribut eof Ipub or GetDestination or what whill be used to even set the destination using the code,.

Thanks,

Avinash

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Avinash,

Below is the code snippet to update/change destination email address in a publication recurring schedule:

<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>

<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>

<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>

<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>

<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>

<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>

<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>

<%@ page import="com.crystaldecisions.sdk.occa.infostore.* "%>

<%@ page import="com.crystaldecisions.sdk.plugin.desktop.user.*" %>

<%@ page import="com.crystaldecisions.sdk.plugin.CeProgID.*" %>

<%@ page import="com.crystaldecisions.sdk.properties.*" %>

<%@ page import="com.businessobjects.sdk.plugin.desktop.publication.*" %>


<html>
<body>

<%

  String status=null;

  String systemName = "localhost:6400";

  String userName = "Administrator";

  String password = "";

  String authType = "secEnterprise";

  IEnterpriseSession enterpriseSession=null;

  IInfoObjects results=null;

  IInfoStore iStore=null;

  try

  {

ISessionMgr enterpriseSessionMgr = CrystalEnterprise.getSessionMgr();

    enterpriseSession = enterpriseSessionMgr.logon(userName, password, systemName, authType);

   

    iStore = (IInfoStore)enterpriseSession.getService("InfoStore");

IInfoObjects oIInfoObjects = iStore.query("Select * from ci_infoobjects where si_kind='Publication' and si_recurring=1");

  

   for(int i=0; i<oIInfoObjects.getResultSize();i++)

   {

     IPublication publication =(IPublication)oIInfoObjects.get(i);

    

     IDestinations destinations = publication.getSchedulingInfo().getDestinations();

    

      for (Object o:destinations)

     

      {

     IDestination destination = (IDestination)o;

     IProperties properties = destination.properties();

     IProperties ppt = properties.getProperties("SI_DEST_SCHEDULEOPTIONS");

     IProperties mailAddress = ppt.getProperties("SI_MAIL_ADDRESSES");

     IProperty address = (IProperty) mailAddress.getProperty("1");

     String email = (String) address.getValue();

     out.println(email);

     address.setValue("abc@xyz.com, abc@sap.com");

   

     }

     out.println("Successfully changed email address for publication");

         }

  

   iStore.commit(oIInfoObjects);

}

    catch(Exception e)  

{

  out.println(e);

  }

%>

</body>

</html>

Hope it helps.

Regards,

Anchal

Former Member
0 Kudos

Hi Anchal,

Thanks for the code, I need Dynamic destination like, SMTP, FTP, so when I need to send it to FTP, it goes to FTP, when I need to send to EMAIL , it goes there.

So the DestinationProperties will give me that option.

Thanks,
Avinash

Former Member
0 Kudos

Hi Avinash,

Yes, you can set the destination options using destination properties. In your scenario, you can set the destination options dynamically based on the condition.

Regards,

Anchal