createCampaign

CampaignInfo createCampaign(String userCredential,
        String partitionName,
        Locale requestedLocale,
        String securityPolicyName,
        WSReference wsReference,
        String name, Attribute[] attributes)
    throws InvalidFolderException, AttributeNotFoundException,
        InvalidAttributeException;

Create a new campaign for the client, partition, and securityPolicyName, applying the specified attributes. All campaigns that are created by this API are under the root folder.

To create campaigns under a specific folder, use the WSReference parameter to specify the campaign folder.

Example

private static void createCampaign
    (String userName, String partitionName, Locale loc, String securityPolicy, 
                      String campaignName, long campaignfolderID)
{
    WSAttribute[] wsAttributes = { WSAttributeUtils.getWSTextAttribute
          (IAttributeMetadata.AC_CAMPAIGN_DESCRIPTION_ATTRIBUTE_NAME, null,new String[] 
          { "description " + System.currentTimeMillis() }) };
 
  try
  {
    WSReference wsReference = WSAttributeUtils.getWSReference
          (WSComponentTypeEnum.FOLDER, campaignfolderID);
    WSCampaignInfo wsCampaignInfo = CLIENT.createCampaign
          (userName, partitionName, loc, securityPolicy, wsReference, campaignName, wsAttributes);

    System.out.println("Created Campaign with Name: " + wsCampaignInfo.getName() 
           + " CampaignCode: " + wsCampaignInfo.getCampaignCode());  
  }
  catch (CampaignServicesException e)
  {
    e.printStackTrace();
  }
}