IRelationshipCol::Add

Meta Data Services Programming

Meta Data Services Programming

IRelationshipCol::Add

This method is used to add a new item to a repository relationship collection when the sequencing of relationships in the collection is not important. An interface pointer for the new relationship is passed back to the caller.

HRESULT Add(     IDispatch         *plReposObj,
    BSTR               Name,
    
IRelationship   **pplRelship
);

Parts

*plReposObj

[in]
The object for which a relationship is to be added to the relationship collection. 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.

Name

[in]
The name of the new relationship.

*pplRelship

[out]
The IRelationship interface pointer of the newly added relationship.

Return Value

S_OK

The method completed successfully.

Error Values

This method failed to complete successfully.

Remarks

You can add a relationship to a collection only when the collection source object is also the collection origin object.

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

You can use this method to create 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 TargetVersions collection of the versioned relationship.

See Also

IRelationship Interface

IRelationshipCol Interface