IStringCollection::Insert (Opnum 16)

The IStringCollection::Insert (opnum 16) method inserts an item into the collection at a given position.

 HRESULT Insert(
   [in] LONG index,
   [in] BSTR value

index: The position at which to insert the string.

value: The string to insert into the collection.

Return Values: The method MUST return information in an HRESULT data structure. The severity bit in the structure identifies the following conditions:

  • If the severity bit is set to 0, the method completed successfully.

  • If the severity bit is set to 1, the method failed and encountered a fatal error.

If the collection is read-only, the server SHOULD return WU_E_NOT_SUPPORTED (0x80240037).

If the index is less than 0x00000000 or greater than the number of items in the collection, the server SHOULD return WU_E_INVALIDINDEX (0x80240007). The server MUST allow insertion at the end of the collection.

Exceptions Thrown: No exceptions are thrown beyond those thrown by the underlying RPC protocol [MS-RPCE].

This method SHOULD insert the given value into its List ADM element at the given index, and increment the value of its Count ADM element.