Plumtree EDK (Enterprise Web Development Kit) 5.4.0 |

# IContentItem Interface

An `IContentItem` represents a content item. It manages property value modification and retrieval, and encapulates a content item's meta-data.

To update property values for a new content item use `SetPropertyValue` for the various property types and then persist the values with `IContentItemManager.CheckInItem`.

To update property values for an existing content item first check out the item with `IContentItemManager.CheckOutItem` then modify property values with `Get/SetPropertyValue` and then finally persist the modifications with `IContentItemManager.CheckInItem`.

For information about the conditions that make a content item searchable in the Search Server, refer to the documentation in IPresentationTemplate.Searchable.

Note: To use any file upload/download functionality for setting/retreving a file or image property value, WSE 2.0 (http://msdn.microsoft.com/webservices/building/wse/) must be installed.

The following example code determines what types of properties exist on a content item and how to modify their values:

    //To modify property values on an existing item, first check-out the item.
    itemManager.CheckOutItem(contentItem);

    //Retrieve all the properties on the content item
    IBaseProperty[] allProps = contentItem.GetAllProperties();

    for (int i = 0; i < allProps.Length; i++)
    {
      //Test if the property a text block property
      if (allProps[i] is ITextBlockProperty)
      {
          String oldValue = "";
          if (contentItem.HasPropertyValue(allProps[i]))
          {
            //Retrieve the old text block value if it has been set previously
            oldValue = contentItem.GetTextBlockPropertyValue(allProps[i]);
           }
           //Set the new value
           contentItem.SetTextBlockPropertyValue(allProps[i], "Updated Value: " + oldValue);
      }
      //Test if the property is an integer property
      else if (allProps[i] is IIntegerProperty)
      {
           int oldValue = 0;
           if (contentItem.HasPropertyValue(allProps[i]))
           {
              oldValue = contentItem.GetIntegerPropertyValue(allProps[i]);
           }
           contentItem.SetIntegerPropertyValue(allProps[i], 100 + oldValue);

            //Test for rest of the property types...
      }
    }

    //Finally, check-in the item to persist the updated values
    itemManager.CheckInItem(contentItem, "Check In Comment");

Note: A content item will be automatically deleted if the underlying Data Entry Template has been deleted.

A content item can be indexed and made searchable, if it
- 1) is published, and
- 2) at publish time:
- - has the attached Presentation Template's `Searchable` set to `true`, and
- - has a portlet associated with the item.

A portlet can be associated with a content item directly or indirectly:
- 1) Directly - Associate a portlet with a content item by setting the portlet ID on the item. The content item and the portlet thus become a Portlet Item.
- 2) Indirectly - Associate a portlet to one of the item's containing folders by adding the portlet ID to the folder. The folder must contain either a publishable Presentation Template or a content item that has already been associated to the same portlet. The folder can be either the folder containing the item, or any parent folder of that containing folder.

Refer to the Administrator Guide for Content Server for additional details on content item and portlet association.

For a list of all members of this type, see IContentItem Members.

public interface IContentItem

#### Requirements

Namespace: Plumtree.Remote.PRC.Content.Item

Assembly: edk (in edk.dll)

#### See Also

IContentItem Members | Plumtree.Remote.PRC.Content.Item Namespace