IProduct3::AddRelationshipToCategory Method [C++]

Use this method to add a relationship to a specified category in a specified catalog from this product.

Definition

[C++]

HRESULT IProduct3::AddRelationshipToCategory(BSTRstrRelatedCategoryName,
  BSTRstrRelationshipName,
  VARIANTstrRelationshipDescription,BSTRstrTargetCatalogName);

[Visual Basic]

Sub AddRelationshipToCategory(strRelatedCategoryName As String,
  strRelationshipName As String,
  Optional strRelationshipDescription As Variant,
  strTargetCatalogName As String)

Parameters

  • strRelatedCategoryName[C++]
    [in] A BSTR that contains the name of the category to which a relationship is to be added.
  • strRelatedCategoryName[Visual Basic]
    A String that contains the name of the category to which a relationship is to be added.
  • strRelationshipName[C++]
    [in] A BSTR that contains a name for the relationship.
  • strRelationshipName[Visual Basic]
    A String that contains a name for the relationship.
  • strRelationshipDescription[C++]
    [in, optional] A VARIANT that optionally contains a description for the relationship. See the Remarks section for more information.
  • strRelationshipDescription[Visual Basic]
    A Variant that optionally contains a description for the relationship. See the Remarks section for more information.
  • strTargetCatalogName [C++]
    [in] A BSTR that contains the name of the catalog that contains the category specified in strRelatedCategoryName****.
  • strTargetCatalogName [Visual Basic]
    A String that contains the name of the catalog that contains the category specified in strRelatedCategoryName.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_CATALOG_DOESNT_EXIST

[C++] 0x88980002

[Visual Basic] &H88980002

The catalog name you specified does not exist.
E_CAT_INVALID_CATALOGNAME

[C++] 0x88980063

[Visual Basic] &H88980063

The catalog name you specified is invalid. Catalog names cannot be blank.
E_CAT_INVALID_CATALOG_NAME_LENGTH

[C++] 0x88980042

[Visual Basic] &H88980042

The catalog name you specified exceeds the maximum limit of 85 characters.
E_CAT_CHARACTER_NOT_ALLOWED

[C++] 0x8898003D

[Visual Basic] &H8898003D

The catalog name you specified has one of the nine reserved characters " [ ] , ' ( )#. which should not be used.
E_CAT_INVALID_CATEG_LENGTH

[C++] 0x88980047

[Visual Basic] &H88980047

The category name you specified is either blank or exceeds the maximum allowed length of 128 characters or cannot be converted to a string.
E_CAT_VC_INVALID_PROD_ID_OR_CATEGORY_NAME

[C++] 0x889800FB

[Visual Basic] &H889800FB

The value you specified for the productID or CategoryName exceeds the maximum allowed length of 348 characters.
E_CAT_INVALID_RELATION_NAME

[C++] 0x88980054

[Visual Basic] &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] &H889800B6

The input parameter <parameter number> is invalid.
E_CAT_INVALID_RELATION_DESC

[C++] 0x88980055

[Visual Basic] &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] &H88980002

The catalog name you specified does not exist.
E_CAT_CATEGORY_DOESNT_EXIST

[C++] 0x8898001C

[Visual Basic] &H8898001C

The Category you specified doesn't exist.
E_CAT_INVALID_RELATION

[C++] 0x88980039

[Visual Basic] &H88980039

An invalid relation is specified. Self relations are not supported.
E_CAT_VC_CANT_EDIT_INCLUDED_RELATIONSHIP

[C++] 0x8898011B

[Visual Basic] &H8898011B

A virtual catalog's included relationships cannot be directly edited. Instead, they can only be edited in the base catalog context.
E_CAT_VC_ERROR_IN_PROPAGATING_BC_CHANGES

[C++] 0x88980101

[Visual Basic] &H88980101

There was an error in propagating the base catalog changes to the dependent virtual catalogs.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++]

The new relationship must have a name, which you specify in the strRelationshipName parameter. It may also optionally have a description, which you specify in the strRelationshipDescription parameter. The description of a relationship is a multilingual attribute. Specifying the strRelationshipDescription parameter will set the description in the current language of the catalog. Use the SetRelatedCategories method to create descriptions in other languages.

[Visual Basic]

The new relationship must have a name, which you specify in the strRelationshipName parameter. It may also optionally have a description, which you specify in the strRelationshipDescription parameter. The description of a relationship is a multilingual attribute. Specifying the strRelationshipDescription parameter will set the description in the current language of the catalog. Use the SetRelatedCategories method to create descriptions in other languages.

More than one relationship may be created between the same product and category; however, in this case each relationship created must be given a unique name.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

'vDesc is a Variant of subtype String containing the description.
myProduct.AddRelationshipToCategory "Apparel", "Accessory", vDesc, "myCat"

See Also

[C++]Product Object

[Visual Basic]Product Object

[C++]IProduct3::AddRelationshipToProduct

[Visual Basic]Product.AddRelationshipToProduct

[C++]IProduct3::RemoveRelationshipToCategory

[Visual Basic]Product.RemoveRelationshipToCategory

[C++]IProduct3::SetRelatedCategories

[Visual Basic]Product.SetRelatedCategories

Copyright © 2005 Microsoft Corporation.
All rights reserved.