Share via


AddRelationshipToProduct Method (String, String, String, String, Int32)

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

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

Syntax

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

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

Parameters

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 products. The products 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 targetProductId should:

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

  • Not exceed 343 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 relationship between this catalog item and the same targetProductId provided the relationshipName is unique.

Permissions

See Also

Reference

CatalogItem Class

CatalogItem Members

AddRelationshipToProduct Overload

Microsoft.CommerceServer.Catalog Namespace