Share via


ProductCatalog3.AddVirtualCatalogRule Method (PIA)

Use this method to add an inclusion or exclusion rule for a specific product, category, variant, or catalog to the current virtual catalog. This method applies only to virtual catalogs.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub AddVirtualCatalogRule(strCatalogName As String,
  vrProductIDOrCategoryName As Object,
  Optional vrVariantID As Object,
  Optional fCategory As Boolean,
  Optional fExclusion As Boolean)

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
…
public void AddVirtualCatalogRule(stringstrCatalogName,
  objectvrProductIDOrCategoryName,
  objectvrVariantID,
  bool fCategory,
  boolfExclusion);

Parameters

[Visual Basic .NET]

  • strCatalogName
    A String that contains the catalog name.
  • vrProductIDOrCategoryName
    An Object that contains the product ID or category name to which the rule applies.
  • vrVariantID
    An Object that contains the variant ID to which the rule applies.
  • fCategory
    A Boolean that specifies whether the parameter vrProductIDOrCategoryName is a product or a category. A value of True (-1) indicates a category. A value of False (0) indicates a product. The default value is False (0).
  • fExclusion
    A Boolean that specifies whether this is an inclusion or exclusion rule. A value of True indicates an exclusion rule. A value of False indicates an inclusion rule. The default value is False.

[C#]

  • strCatalogName
    A string that contains the catalog name.
  • vrProductIDOrCategoryName
    An object that contains the product ID or category name to which the rule applies.
  • vrVariantID
    An object that contains the variant ID to which the rule applies.
  • fCategory
    A bool that specifies whether the parameter vrProductIDOrCategoryName is a product or a category. A value of True (-1) indicates a category. A value of False (0) indicates a product. The default value is False (0).
  • fExclusion
    A bool that specifies whether this is an inclusion or exclusion rule. A value of True indicates an exclusion rule. A value of False indicates an inclusion rule. The default value is False.

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 COMException may wrap as exceptions for this method.

Constant Value Description
E_CAT_VC_NOT_A_VIRTUAL_CATALOG

[C#] 0x889800FA

[Visual Basic .NET] &H889800FA

Invalid catalog type. This API can only be called on a virtual catalog.
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] &H8898003D

The catalog name you specified has one of the nine reserved characters " [ ] , ' ( )#. that should not be used.
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_VC_INVALID_VARIANT_ID

[C#] 0x889800FC

[Visual Basic .NET] &H889800FC

The value you specified for the VariantID exceeds the maximum allowed length of 348 characters.
E_CAT_VC_INVALID_ITEM

[C#] 0x889800FD

[Visual Basic .NET] &H889800FD

The specified product/category/variant could not be found in the base catalog.
E_CAT_VC_TOO_MANY_BASECATALOGS

[C#] 0x88980106

[Visual Basic .NET] &H88980106

The limit (84) on the maximum number of base catalogs that can be included in a virtual catalog has been exceeded.

Remarks

If the fCategory parameter is True and the vrProductIDOrCategoryName parameter is an empty string, then the entire catalog will be included.

Exclusion rules always override inclusion rules. If you exclude a category you cannot include any category or product contained within that category. Conversely, you can exclude any category or product contained within a category you have included.

If a value is provided for the vrVariantID parameter, then the rule will apply only to that variant of the product. If any variant of a product is included, then the product will be implicitly included. It is not possible to have a variant without a parent product.

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

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

ProductCatalog3 Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.