IRelationshipCol::Insert

Meta Data Services Programming

Meta Data Services Programming

IRelationshipCol::Insert

This method adds a relationship 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
);

Parts

*pIReposObj

[in]
The repository object to be inserted into the collection sequence through the new relationship. The value of plReposObj is the specific version of the target object. If you are operating within the context of a workspace, the target object version you specify with plReposObj must be present in the workspace.

iIndex

[in]
The index of the sequence location where the relationship is to be inserted. If another relationship is already present at this sequence location, the new relationship is inserted in front of the existing relationship.

Name

[in]
The name you supply for the object to which the new relationship connects.

*ppIRelship

[out]
The IRelationship interface pointer for the new relationship.

Return Value

S_OK

The method completed successfully.

Error Values

This method failed to complete successfully.

Remarks

Relationships can be inserted into a collection only if the collection source object is also the collection 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 target object version. 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 TargetVersions collection of the versioned relationship.

See Also

IRelationshipCol Interface

IRelationship Interface