Show TOC

addItems MethodLocate this document in the navigation structure

Use

addItems( collectionItemsArray, collectionID, parentID, overwrite)

Adds an array of items to an existing collection. By calling this method, you avoid redrawing of the screen after adding each entry.

Parameter

Description

collectionItemsArray

An array of the Item objects representing the items to add to the collection

collectionID

ID of a collection to which to add the specified items

parentID (optional)

ID of the parent item (folder) that should contain the added items. Relevant for nested collections (currently only for menus); for other collections types a null value is expected.

overwrite (optional)

Defines whether to overwrite an existing item with the same parameters. Default value is false.

Return Value

A boolean array, each member of which indicates whether the respective item was added successfully:

  • True, if the item was added

  • False, if the item was not added, either because an item with the same parameters already exists in the specified collection, or the specified collection was not found

Example

Sample Code
                  
var itemsArray = new Array(); 
itemsArray[0] = new LSAPI.Collections.Item( "firstItemID",  "title1", LSAPI.Collections.Types.MENU, "tooltip1", "roles://mytarget1");
itemsArray[1] = new LSAPI.Collections.Item( "secondItemID", "title2", LSAPI.Collections.Types.MENU, "tooltip2", "roles://mytarget2");
var verifySuccesses = LSAPI.Collections.addItems(itemsArray, "parentCollectionID", "parentItemID", true);