InsertItem method: Content Reference collection

Syntax

InsertItem(ContentReferenceName, ContentReferenceLabel, Node, URL)

Description

The InsertItem method inserts the content reference object identified by ContentReferenceName into the content reference Collection.

Note:

The portal registry classes execute some methods "interactively", that is, as they happen. The item won't be marked for insertion, then actually inserted later. The item is inserted into the database as soon as the method is executed.

Parameters

Parameter Description

ContentReferenceName

Specify the name of a new content reference. This parameter takes a string value. If you specify a name that already exists in the collection, you get an error.

ContentReferenceLabel

Specify a description of the new content reference. This is the translated value. This parameter takes a string value.

Node

Specify a node. This parameter takes a string value. If you specify a fully qualified value for URL, you can specify a NULL (that is, two quotation marks with no space between them ("")).

URL

Specify a URL that contains the content. The format of this parameter depends on other properties, such as the type of content reference, where the data is stored, and so on.

Returns

A reference to the new content reference object if the method executed successfully, NULL otherwise.

Example

The following example inserts an external content reference that is a template:

&URL = "t/" | &ITEMNAME;
&MyCRef = &CRefColl.InsertItem(&ITEMNAME, &ITEMLABEL, "", &URL);

The following example inserts a content reference where URLType is iScript (USCR):

&URL = "s/WEBLIB_PORTAL.FieldFormula.Portal_Trans_Dyn"
&MyCRef = &CRefColl.InsertItem(&ITEMNAME, &ITEMLABEL, "HRMS", &URL);

Related Topics