To create new content items based on existing Data Entry Templates and Presentation Templates, use the IContentItemManager and IContentItem interfaces in the IDK.
Several processes are required before you can create a content item. The steps below provide a summary.
Java
... // Get a content item manager object. IContentItemManager ciManager = factory.getContentItemManager(); // Create a new content item. IContentItem contentitem = ciManager.createContentItem(det.getContainingFolder(), "Incident 123", det); // Retrieve the properties from the Data Entry Template. IBaseProperty[] props = det.getAllProperties(); // Set the incident ID as an integer property. contentitem.setIntegerPropertyValue(props[0], 123); // Set the resolution status as a Boolean property. contentitem.setBooleanPropertyValue(props[1], false); // Set the severity level as a real property. contentitem.setDoublePropertyValue(props[2], 0.70 ); // Set the date the incident was opened as a date property. contentitem.setDatePropertyValue(props[3], new Date()); // Set the name of the customer as a text property. contentitem.setTextLinePropertyValue(props[4], "Joe Customer"); // Set the incident description as a long text property contentitem.setTextBlockPropertyValue(props[5], "Can't open the application."); // Link to another content item that contains customer information. IContentItem customerData= ciManager.getContentItem(det.getContainingFolder(), "Customer Information"); contentitem.setItemReferencePropertyValue(props[6], customerData); // Select the product from a selection list. // When setting a selection list value, the passed-in string should // exactly match one of the values in the selection list. contentitem.setSelectionListPropertyValue(props[7], "ALI"); // Set the value of the log file property. // The name of the file can be set to a different file name FileInputStream log = new FileInputStream("C:\uploads\logFile.txt"); contentItem.setFilePropertyValue(props[8], "logFile.txt", log); // Set the image property value. // The name of the image can be set to a different name FileInputStream screenShot = new FileInputStream("C:\uploads\screenshot.jpg"); contentItem.setImagePropertyValue(props[9], "screenshot.jpg", screenShot); // Store the content item by checking it in. ciManager.checkInItem(contentitem, "New incident."); ...
.NET (C#)
... // Get a content item manager object. IContentItemManager ciManager = factory.GetContentItemManager(); // Create a new content item. IContentItem contentitem = ciManager.CreateContentItem(det.GetContainingFolder(), "Incident 123", det); // Retrieve the properties from the Data Entry Template. IBaseProperty[] props = det.GetAllProperties(); // Set the incident ID as an integer property. contentitem.SetIntegerPropertyValue(props[0], 123); // Set the resolution status as a Boolean property. contentitem.SetBooleanPropertyValue(props[1], false); // Set the severity level as a real property. contentitem.SetDoublePropertyValue(props[2], 0.70 ); // Set the date the incident was opened as a date property. contentitem.SetDatePropertyValue(props[3], DateTime.Now); // Set the name of the customer as a text property. contentitem.SetTextLinePropertyValue(props[4], "Joe Customer"); // Set the incident summary as a long text property. contentitem.SetTextBlockPropertyValue(props[5], "Can't open the application."); // Link to another content item that contains customer information. IContentItem customerData = ciManager.GetContentItem(det.GetContainingFolder(), "Customer Information"); contentitem.SetItemReferencePropertyValue(props[6], customerData); // Select the product from a selection list. // When setting a selection list value, the passed-in string should exactly // match one of the values in the selection list. contentitem.SetSelectionListPropertyValue(props[7], "ALI"); // Set the value of the log file property. // The name of the file can be set to a different file name FileStream log = new FileStream("C:\uploads\logFile.txt", FileMode.Open); contentItem.setFilePropertyValue(props[8], "logFile.txt", log); // Set the image property value. // The name of the image can be set to a different name FileStream screenShot = new FileStream("C:\uploads\screenshot.jpg", FileMode.Open); contentItem.setImagePropertyValue(props[9], "screenshot.jpg", screenShot); // Store the content item by checking it in. ciManager.CheckInItem(contentitem, "Automatically created an article."); ...
.NET (VB)
... 'Get the Content Item Manager. Dim contentFactory As IContentFactory = remoteSession.GetContentFactory() Dim contentItemManager As IContentItemManager = contentFactory.GetContentItemManager() ' Create a new Content Item. Dim contentItemName As String = CType(pnlMain.FindControl("Incident 123"), TextBox).Text Dim contentItem As IContentItem = contentItemManager.CreateContentItem(dataEntryTemplate.GetContainingFolder, contentItemName, dataEntryTemplate) ' Retrieve the properties from the Data Entry Template. Dim props() As IBaseProperty = det.GetAllProperties() ' Set the incident ID as an integer property. contentitem.SetIntegerPropertyValue(props(0), 123) ' Set the resolution status as a Boolean property. contentitem.SetBooleanPropertyValue(props(1), False) ' Set the severity level as a real property. contentitem.SetDoublePropertyValue(props(2), 0.7) ' Set the date the incident was opened as a date property. contentitem.SetDatePropertyValue(props(3), DateTime.Now) ' Set the name of the customer as a text property. contentitem.SetTextLinePropertyValue(props(4), "Joe Customer") ' Set the incident summary as a long text property. contentitem.SetTextBlockPropertyValue(props(5), "Can't open the application.") ' Link to another content item that contains customer information. Dim customerData As IContentItem = ciManager.GetContentItem(det.GetContainingFolder(), "Customer Information") contentitem.SetItemReferencePropertyValue(props(6), customerData) ' Select the product from a selection list. ' When setting a selection list value, the passed-in string should exactly ' match one of the values in the selection list. contentitem.SetSelectionListPropertyValue(props(7), "ALI") ' Set the value of the file property. ' The name of the file can be set to a different file name Dim log As FileStream = New FileStream("C:\uploads\logFile.txt", FileMode.Open) contentItem.SetFilePropertyValue(props(8), "logFile.txt", log) ' Set the value of the image property ' The name of the image can be set to a different name Dim screenShot As FileStream = New FileStream("C:\uploads\screenshot.jpg", FileMode.Open) contentItem.SetImagePropertyValue(props(9), "screenshot.jpg", screenShot) ' Store the content item by checking it in. ciManager.CheckInItem(contentitem, "Automatically created an article.") ...