To edit an existing Publisher content item, use the IContentItemManager and IContentItem interfaces in the IDK.
Java
...
// check out the content item
itemManager.checkOutItem(contentItem);
//Retrieve all the properties of the content item.
IBaseProperty[] allProps = contentItem.getAllProperties();
for (int i = 0; i < allProps.length; i++)
{
//Check for a text property.
if (allProps[i] instanceof ITextBlockProperty)
{
//Retrieve the value of the text property.
String oldValue = contentItem.getTextBlockPropertyValue((ITextBlockProperty)allProps[i]);
//Add a message to the existing string.
contentItem.setTextBlockPropertyValue((ITextBlockProperty)allProps[i], "Severity upgraded. " + oldValue);
}
//Check for a double property.
else if (allProps[i] instanceof IDoubleProperty)
{
//Set the new value of the existing property
contentItem.setIntegerPropertyValue((IIntegerProperty)allProps[i], .9);
}
}
//Check in the content item to maintain the persistence of the updated values.
itemManager.checkInItem(contentItem, "Severity Upgraded");
...
.NET (C#)
...
//Check out the content item.
itemManager.CheckOutItem(contentItem);
//Retrieve all the properties on the content item.
IBaseProperty[] allProps = contentItem.GetAllProperties();
for (int i = 0; i < allProps.Length; i++)
{
//Check for a text block property.
if (allProps[i] is ITextBlockProperty)
{
String oldValue = "";
if (contentItem.HasPropertyValue(allProps[i]))
{
//Retrieve the old value.
oldValue = contentItem.GetTextBlockPropertyValue(allProps[i]);
}
//Set the new value.
contentItem.SetTextBlockPropertyValue(allProps[i], "Severity upgraded. " + oldValue);
}
//Check for an integer property.
else if (allProps[i] is IDoubleProperty)
{
//Set the new value for the existing property
contentItem.SetIntegerPropertyValue(allProps[i], .9);
}
}
//Check in the content item to store the updated values.
itemManager.CheckInItem(contentItem, "Severity Upgraded");
...
.NET (VB)
...
' Check out the content item.
contentItemManager.CheckOutItem(contentItem)
' Retrieve all the properties on the content item.
Dim allProps As IBaseProperty() = contentItem.GetAllProperties
Dim i As Integer
For i = 0 To allProps.Length - 1
' Check for a text block property.
If TypeOf allProps(i) Is ITextBlockProperty Then
Dim oldValue As String = ""
If contentItem.HasPropertyValue(allProps(i)) Then
'Retrieve the old text block value if it has been set previously.
oldValue = contentItem.GetTextBlockPropertyValue(allProps(i))
End If
' Set the new value.
contentItem.SetTextBlockPropertyValue(allProps(i), ("Severity upgraded. " & oldValue))
Else
' Test if the property is an integer property.
If TypeOf allProps(i) Is IIntegerProperty Then
' Set the new value for the existing property
contentItem.SetIntegerPropertyValue(allProps(i), (.9))
End If
End If
Next i
'Check in the content item to store the updated values.
contentItemManager.CheckInItem(contentItem, "Severity Upgraded")
...