AddRelationshipToCategory Method (String, String, String, String)
Adds a relationship to the target category in the target catalog.
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 _
)
'Usage
Dim instance As CatalogItem
Dim targetCatalogName As String
Dim targetCategoryName As String
Dim relationshipName As String
Dim relationshipDescription As String
instance.AddRelationshipToCategory(targetCatalogName, _
targetCategoryName, relationshipName, _
relationshipDescription)
public void AddRelationshipToCategory(
string targetCatalogName,
string targetCategoryName,
string relationshipName,
string relationshipDescription
)
public:
void AddRelationshipToCategory(
String^ targetCatalogName,
String^ targetCategoryName,
String^ relationshipName,
String^ relationshipDescription
)
public function AddRelationshipToCategory(
targetCatalogName : String,
targetCategoryName : String,
relationshipName : String,
relationshipDescription : String
)
Parameters
- targetCatalogName
Type: System..::.String
The target catalog name.
- targetCategoryName
Type: System..::.String
The category to add the relationship to.
- relationshipName
Type: System..::.String
The relationship name.
- relationshipDescription
Type: System..::.String
The relationship description.
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 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.