Product3.AddRelationshipToProduct Method (PIA)
Use this method to add a relationship from this product to a specified product in the specified catalog.
Definition
[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub AddRelationshipToProduct(varRelatedProductID As Object,
strRelationshipName As String,
Optional strRelationshipDescription As ObjectstrTargetCatalogNameStack As String)
[C#]
using Microsoft.CommerceServer.Interop.Catalog;
…
public void AddRelationshipToProduct(objectvarRelatedProductID,
stringstrRelationshipName,
objectstrRelationshipDescription,stringstrTargetCatalogNameStack);
Parameters
[Visual Basic .NET]
- varRelatedProductID
An Object that contains the ID of the related product. - strRelationshipName
A String that contains the name of the relationship. - strRelationshipDescription
An Object that optionally contains a description for the relationship. - strTargetCatalogNameStack
A String that contains the name of the catalog that contains the category specified in varRelatedProductID.
[C#]
- varRelatedProductID
An object that contains the ID of the related product. - strRelationshipName
A string that contains the name of the relationship. - strRelationshipDescription
An object that optionally contains a description for the relationship. Set to Type.Missing to omit a description. - strTargetCatalogNameStack
A string that contains the name of the catalog that contains the category specified in varRelatedProductID.
Exceptions
This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.
The following table shows the custom COM errors that a COMException can wrap.
Constant | Value | Description |
---|---|---|
E_CAT_CATALOG_DOESNT_EXIST | [C#] 0x88980002 [Visual Basic .NET] &H88980002 |
The catalog name you specified does not exist. |
E_CAT_INVALID_CATALOGNAME | [C#] 0x88980063 [Visual Basic .NET] &H88980063 |
The catalog name you specified is invalid. Catalog names cannot be blank. |
E_CAT_INVALID_CATALOG_NAME_LENGTH | [C#] 0x88980042 [Visual Basic .NET] &H88980042 |
The catalog name you specified exceeds the maximum limit of 85 characters. |
E_CAT_CHARACTER_NOT_ALLOWED | [C#] 0x8898003D [Visual Basic .NET] &Hx8898003D |
The catalog name you specified has one of the nine reserved characters " [ ] , ' ( )#. that should not be used. |
E_CAT_INVALID_RELATION_NAME | [C#] 0x88980054 [Visual Basic .NET] &H88980054 |
The value you specified for the relationship name is blank or exceeds 128 characters. Relationship names should not be blank and should be less than or equal to 128 characters. |
E_CAT_INVALID_PARAMETER | [C#] 0x889800B6 [Visual Basic .NET] &H889800B6 |
The input parameter <parameter number> is invalid. |
E_CAT_INVALID_PRODUCTID | [C#] 0x8898005B [Visual Basic .NET] &H8898005B |
The value you specified for the productID is blank or exceeds the maximum allowed length of 256 characters. |
E_CAT_INVALIDVALUE_FOR_PRODUCTID | [C#] 0x8898004E [Visual Basic .NET] &Hx8898004E |
The value you specified for the productID is either out of range or does not satisfy the Min/Max condition. |
E_CAT_VC_INVALID_PROD_ID_OR_CATEGORY_NAME | [C#] 0x889800FB [Visual Basic .NET] &H889800FB |
The value you specified for the productID or CategoryName exceeds the maximum allowed length of 348 characters. |
E_CAT_INVALID_RELATION_DESC | [C#] 0x88980055 [Visual Basic .NET] &H88980055 |
The value you specified for the relationship description exceeds 256 characters. Relationship description should be less than or equal to 256 characters. |
E_CAT_CATALOG_DOESNT_EXIST | [C#] 0x88980002 [Visual Basic .NET] &H88980002 |
The catalog name you specified does not exist. |
E_CAT_PRODUCT_DOESNT_EXIST | [C#] 0x8898001E [Visual Basic .NET] &H8898001E |
The product you specified does not exist. |
E_CAT_INVALID_RELATION | [C#] 0x88980039 [Visual Basic .NET] &H88980039 |
An invalid relation is specified. Self relations are not supported. |
E_CAT_VC_CANT_EDIT_INCLUDED_RELATIONSHIP | [C#] 0x8898011B [Visual Basic .NET] &H8898011B |
A virtual catalog's included relationships cannot be directly edited. They can edited only in the base catalog context. |
E_CAT_VC_ERROR_IN_PROPAGATING_BC_CHANGES | [C#] 0x88980101 [Visual Basic .NET] &H88980101 |
There was an error in propagating the base catalog changes to the dependent virtual catalogs. |
Remarks
The new relationship must have a name, which you specify in the strRelationshipName parameter. It may also optionally have a description, which you can specify in the strRelationshipDescription parameter.
More than one relationship may be created between the same two products, however in this case each relationship created must be given a unique name.
[Visual Basic .NET]
Example
'vProdID is an Object containing the product ID
'vDesc is an Object of subtype String containing a description
'of the relationship
myProduct.AddRelationshipToProduct(vProdID, "Accessory", vDesc, "myCatalog")
Requirements
Namespace: Microsoft.CommerceServer.Interop.Catalog
Platforms: Windows 2000, Windows Server 2003
Assembly: Cataloglib (in Cataloglib.dll)
See Also
Product3.AddRelationshipToCategory
Product3.RemoveRelationshipToProduct
Copyright © 2005 Microsoft Corporation.
All rights reserved.