Share via


AddRelationshipToProduct Method (String, String, String, String)

Adds a relationship to the target product in the target catalog.

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 _
)
'Usage
Dim instance As CatalogItem
Dim targetCatalogName As String
Dim targetProductId As String
Dim relationshipName As String
Dim relationshipDescription As String

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

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

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