Partilhar via


AddRelationshipToCategory Method (String, String, String, String, Int32)

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Adds a relationship to the target category in the target catalog, with a rank.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public Sub AddRelationshipToCategory ( _
    targetCatalogName As String, _
    targetCategoryName As String, _
    relationshipName As String, _
    relationshipDescription As String, _
    rank As Integer _
)
'Usage
Dim instance As CatalogItem
Dim targetCatalogName As String
Dim targetCategoryName As String
Dim relationshipName As String
Dim relationshipDescription As String
Dim rank As Integer

instance.AddRelationshipToCategory(targetCatalogName, _
    targetCategoryName, relationshipName, _
    relationshipDescription, rank)
public void AddRelationshipToCategory(
    string targetCatalogName,
    string targetCategoryName,
    string relationshipName,
    string relationshipDescription,
    int rank
)
public:
void AddRelationshipToCategory(
    String^ targetCatalogName, 
    String^ targetCategoryName, 
    String^ relationshipName, 
    String^ relationshipDescription, 
    int rank
)
public function AddRelationshipToCategory(
    targetCatalogName : String, 
    targetCategoryName : String, 
    relationshipName : String, 
    relationshipDescription : String, 
    rank : int
)

Parameters

  • targetCategoryName
    Type: System..::.String
    The category to add the relationship to.

Exceptions

Exception Condition
ArgumentNullException

The relationshipName is nullNothingnullptra null reference (Nothing in Visual Basic).

ValidationException

The relationshipDescription is not valid.

EntityAlreadyExistsException

The relationshipName already exists.

Remarks

Prioritizing, ordering, or sequencing may involve using the rank Property. Positive and negative rank values are allowed in the catalog system.

You can use this method to add relationships to other categories. The categories can be in the same catalog as the current catalog or in another catalog in the catalog system. You should call the Save method to save the relationships to the catalog system. The targetCatalogName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 85 characters.

  • Not contain the .,"[]'()# characters.

  • Exist in the catalog system.

The targetCategoryName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 215 characters.

  • Exist in the targetCatalogName.

The relationshipName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 128 characters.

If specified the relationshipDescription should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 256 characters.

You can create more than one relationships between this catalog item and the same targetCategoryName provided the relationshipName is unique.

Permissions

See Also

Reference

CatalogItem Class

CatalogItem Members

AddRelationshipToCategory Overload

Microsoft.CommerceServer.Catalog Namespace