ITargetObjectCol::Insert

See Also

This method adds an object to the collection at a specified point in the collection sequence. An interface pointer for the new relationship is passed back to the caller.

HRESULT Insert(
IDispatch        *pIReposObj,
long                 iIndex,
BSTR               Name,
IRelationship **ppIRelship
);

Parameters

*pIReposObj
[in]
The Repository object to be inserted into the collection sequence.
iIndex
[in]
The index of the sequence location where the object is to be inserted. If another object is already present at this sequence location, the new object is inserted before the existing object.
Name
[in]
The name of the object. Set this parameter to a null string if the object is not referred to by name.
*ppIRelship
[out]
The IRelationship interface pointer for the new object's relationship with the collection's origin object.

Return Value

S_OK

The method completed successfully.

Error
Values

This method failed to complete successfully.

Remarks

Objects may only be inserted into a collection when the collection's source object is also the collection's origin object.

This method can only be used for collections that are sequenced.

When you call this method, the origin version must be unfrozen.

You can use this method to insert a new versioned relationship between the source object version and a version of the target object. You cannot use it to enlarge a versioned relationship. If the source object version already has a relationship to any version of the target object, this method will fail. You can include another version of the target object in the versioned relationship by adding an item to the versioned relationship's TargetObjects collection.

The value of plReposObj is the specific version of the target object.

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.