AquaLogic Interaction Development Kit (IDK) 6.0.0 |

# IContentItem.SetAssociatedPortletID Method

Sets the portlet ID associated with this content item.

void SetAssociatedPortletID(
int portletID
);

#### Parameters

portletID
  The portlet ID to associate with the item.

#### Remarks

If a content item is associated with a portlet and the item's attached Presentation Template is searchable, then the item will be indexed and made searchable when it is published.

Note: The recommended way to associate a portlet with a content item is through the portlet administration settings in the portal.

An `InvalidOperationException` will be thrown if this method is called on an item that has not been checked out. The content item can only be associated with one portlet ID at a time. If this method is called several times on the same item, the last call will override the previous calls.

The portlet ID must refer to a valid portlet otherwise a `ContentException` will be thrown when `IContentItemManager.CheckInItem` is called on the item.

A portlet can only be associated with one content item or Presentation Template at a time. If the portlet ID is already associated with another content item or Presentation Template, an `InvalidOperationException` will be thrown when `IContentItemManager.CheckInItem` is called on the item.

The ID of a portlet can be retrieved using methods in `Plumtree.Remote.PRC.IPortletManager` or `Plumtree.Remote.PRC.IPortletTemplateManager`.

The association will not be persisted until `IContentItemManager.CheckInItem` is called.

#### Exceptions

Exception Type | Condition
--- | ---
InvalidOperationException | The item is not checked out or has been deleted.
ArgumentException | The portlet ID less than or equal to 0.

#### See Also

IContentItem Interface | Plumtree.Remote.PRC.Content.Item Namespace | Searchable | AddAssociatedPortletID