Category.AddRelationshipToCategory

Ee799051.c++_on(en-US,CS.10).gifEe799051.vb_off(en-US,CS.10).gif

Use this method to add a relationship from this category to another specified category.

Definition

Sub AddRelationshipToCategory(strRelatedCategoryName As String,strRelationshipName As String,Optional strRelationshipDescription As Variant)

Parameters

strRelatedCategoryName

A String that contains the name of the category to which a relationship is to be added.

strRelationshipName

A String that contains a name for the relationship.

strRelationshipDescription

A Variant of sub type String that contains an optional description for the relationship.

Return Values

None.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_CATEGORY_DOESNT_EXIST &H8898001C The specified category did not exist.
E_CAT_INVALID_RELATION &H88980039 The relationship was invalid. A category or product cannot be related to itself.
E_CAT_INVALID_RELATION_DESC &H88980055 The relationship description exceeded 256 characters.
E_CAT_INVALID_RELATION_NAME &H88980054 The relationship name exceeded 128 characters.
E_CAT_RELATIONSHIP_EXISTS &H88980033 The specified relationship already existed.

Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

A relationship must be given a name and may optionally be given a description. The description can include information that describes the nature of the relationship between the categories (for example, an "accessory" or "add-on"). Relationships are one way, that is, if category A has a relationship to category B that does not create a reciprocal relationship from category B to category A.

When multiple relationships are created between the same two categories, each relationship must have a unique name.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

myCategory.AddRelationshipToCategory "Apparel", "Accessory", "This would go great with that!"

See Also

Category Object

Category.RemoveRelationshipToCategory


All rights reserved.