ICatalogManager3::CreateCatalog Method [C++]

Use this method to create a new catalog.

Definition

[C++]

HRESULT ICatalogManager3::CreateCatalog(BSTRstrCatalogName,
  BSTRstrProductID,
  VARIANTstrProductVariantID,
  VARIANTlcidLocale,
  VARIANTstrCurrency,
  VARIANTstrWeightMeasure,
  VARIANTdtStartDate,
  VARIANTdtEndDate,
  VARIANTvrDefaultLanguage,
  VARIANTvrReportingLanguage,
  VARIANT_BOOLfVirtualCatalog,
  IProductCatalog3**ppNewCatalog);

[Visual Basic]

Function CreateCatalog(strCatalogName As String,
  Optional strProductID As String,
  Optional strProductVariantID As Variant,
  Optional lcidLocale As Variant,
  Optional strCurrency As Variant,
  Optional strWeightMeasure As Variant,
  Optional dtStartDate As Variant,
  Optional dtEndDate As VariantOptional vrDefaultLanguage As Variant,
  Optional vrReportingLanguage As Variant,
  Optional fVirtualCatalog As Boolean) As ProductCatalog

Parameters

  • strCatalogName[C++]
    [in] A BSTR that contains the name of the catalog to be created. See the Remarks section for limitations on this parameter.
  • strCatalogName[Visual Basic]
    A String that contains the name of the catalog to be created. See the Remarks section for limitations on this parameter.
  • strProductID[C++]
    [in, optional] A BSTR that contains the product ID property. This parameter is optional when creating a base Catalog object, and ignored when creating a virtual Catalog object.
  • strProductID[Visual Basic]
    A String that contains the product ID property. This parameter is optional when creating a base Catalog object, and ignored when creating a virtual Catalog object
  • strProductVariantID[C++]
    [in, optional] A VARIANT that contains the product variant ID property. This parameter is optional when creating a base Catalog object.
  • strProductVariantID[Visual Basic]
    A Variant that contains the product variant ID property. This parameter is optional when creating a base Catalog object.
  • lcidLocale[C++]
    [in, optional] A VARIANT that contains the locale ID (LCID) of the catalog to be created.
  • lcidLocale[Visual Basic]
    A Variant that contains the locale ID (LCID) of the catalog to be created.
  • strCurrency[C++]
    [in, optional] A VARIANT that contains the currency type of the catalog to be created.
  • strCurrency[Visual Basic]
    A Variant that contains the currency type of the catalog to be created.
  • strWeightMeasure[C++]
    [in, optional] A VARIANT that contains the unit of weight or measure of the catalog to be created.
  • strWeightMeasure[Visual Basic]
    A Variant that contains the unit of weight or measure of the catalog to be created.
  • dtStartDate[C++]
    [in, optional] A VARIANT of subtype DATE that contains the start date.
  • dtStartDate[Visual Basic]
    A Variant of subtype DATE that contains the start date.
  • dtEndDate[C++]
    [in, optional] A VARIANT of subtype DATE that contains the end date.
  • dtEndDate[Visual Basic]
    A Variant of subtype DATE that contains the end date.
  • vrDefaultLanguage[C++]
    [in, optional] A VARIANT that contains the default culture name. The default value is the system culture name. The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values.
  • vrDefaultLanguage[Visual Basic]
    A Variant that contains the ISO 639+1 default culture name. The default value is the system default culture name. The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values.
  • vrReportingLanguage[C++]
    [in, optional] A VARIANT that contains the reporting culture name. If not supplied, the default value of vrReportingLanguage is set to the value of the vrDefaultLanguage parameter.
  • vrReportingLanguage[Visual Basic]
    A Variant that that contains the reporting culture name. If not supplied, the default value of vrReportingLanguage is set to the value of the vrDefaultLanguage parameter.
  • fVirtualCatalog[C++]
    [in, optional, default value (0)] A VARIANT_BOOL that specifies whether to create a virtual Catalog object. A value of True specifies create a virtual Catalog object. A value of False specifies create a base Catalog object.
  • fVirtualCatalog[Visual Basic]
    A Boolean that specifies whether to create a virtual Catalog object. A value of True specifies create a virtual Catalog object. A value of False specifies create a base Catalog object. The default value is False.
  • ppNewCatalog[C++]
    [out, retval] A pointer used to return the IProductCatalog3 interface of the new catalog.

Return Values

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

[Visual Basic] If this method completes successfully, it returns the ProductCatalog object that was created.

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_CATMGR_NOT_INITIALIZED

[C++] 0x889800B5

[Visual Basic] &H889800B5

The CatalogManager object has not been initialized. The CatalogManager object should be initialized before calling this method
E_CAT_INVALID_CATALOGNAME

[C++] 0x88980063

[Visual Basic] &H88980063

The catalog name you specified is invalid. The strCatalogNames parameter 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 following nine reserved characters:
" [ ] , ' ( )#.

You should not use these characters.

E_CAT_INVALID_PARAMETER

[C++] 0x889800B6

[Visual Basic] &H889800B6

The input parameter <parameter number> is invalid.
E_CAT_INVALID_LANGUAGE

[C++] 0x8898009E

[Visual Basic] &H8898009E

The value you specified for the Language parameter is either empty or exceeds the maximum length of 10 characters.
E_CAT_INVALID_PROPERTY_NAME

[C++] 0x889800A2

[Visual Basic] &H889800A2

The property name you specified is invalid. Property names cannot be blank and cannot exceed 100 characters. Property names cannot begin with a digit and cannot contain one of the following five reserved characters:
.,"[]
E_CAT_PRODID_DOESNT_EXIST

[C++] 0x88980010

[Visual Basic] &H88980010

The ProductID you requested to use for this Catalog does not exist in the Product Catalog System. You must first create the Property, after which you may create the Catalog that is based on it.
E_CAT_VARIANTID_DOESNT_EXIST

[C++] 0x88980061

[Visual Basic] &H88980061

The VariantID you requested to use for this Catalog does not exist in the Product Catalog System. You must first create the Property, after which you may create the Catalog that is based on it.
E_CAT_PRODUCTID_MULTILINGUAL

[C++] 0x889800E2

[Visual Basic] &H889800E2

The Property that you specified to be used as the ProductID is a Multilingual property. A multilingual property cannot be used as a ProductID for a catalog
E_CAT_INVALID_DATATYPE_FOR_PRODUCTID

[C++] 0x88980075

[Visual Basic] &H88980075

The Property that you specified for the ProductID has a text, enumeration, filepath, float, money, datetime or boolean data type. A property with any of these data type cannot be used as a ProductID for a catalog
E_CAT_CATALOG_EXISTS

[C++] 0x88980001

[Visual Basic] &H88980001

The Catalog name you specified already exists.

[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 ppNewCatalog parameter contains valid data only if the method completes successfully.

[Visual Basic] The ProductCatalog object returned by this method is valid only if it was created successfully.

If variants are to be used in a base catalog, you must provide a property name in the optional strProductVariantID parameter. If this parameter is not specified upon creation of the base catalog, any attempt to create a product variant in that catalog will fail. This does not apply to virtual catalogs.

If the strProductID or strProductVariantID parameters are of type cscString they are limited to a length of 256 characters. The strProductID or strProductVariantID parameters may not be multilingual properties or properties of type cscText.

Only properties of the type string, integer , biginteger and double can be used to create ProductIds and VariantIds.

The returned ProductCatalog object will be pre-initialized and ready for use.

If the CatalogManager object is initialized by setting the number of full-text catalogs to create to zero, then the full-text catalog will not be created for this catalog. You can later create a full-text catalog for this catalog by calling the RegenerateFreeTextSearchIndex method of the ProductCatalog object

This method cannot be called in a transacted object. This method involves the creation, deletion, or updating of free text indexes. SQL Server does not allow these operations in a transaction.

Catalog names, and therefore the strCatalogName parameter, are limited to 85 characters in length and cannot contain any of the following characters:

  • Pound sign (#)
  • Double quote (")
  • Single quote (')
  • Comma (,)
  • Left square bracket ([)
  • Right square bracket (])
  • Left bracket (()
  • Right bracket ())
  • Period (.)

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

[Visual Basic]

Example

'This example creates a base catalog
Set oNewBaseCatalog = myCatalogManager.CreateCatalog _
"BCatalog", "ItemNum", "SKU")

'This example creates a virtual catalog.
'It will only be active for a limited time and 
'it has a specified default language 
'but reports in the system language.

'vStDate is a variant containing the 
'   date the catalog will become active.
'vEndDate is a variant containing the 
'   date the catalog wiil become inactive.
'vLang is a variant containing a 
'   culture name.

Set oNewVirtualCatalog = myCatalogManager.CreateCatalog _
("VCatalog", , , , , , vStDate, vEndDate, vLang, , True)

See Also

[C++]CatalogManager Object

[Visual Basic]CatalogManager Object

[C++]ICatalogManager3::DeleteCatalog

[Visual Basic]CatalogManager.DeleteCatalog

[C++]ICatalogManager3::GetCatalog

[Visual Basic]CatalogManager.GetCatalog

Copyright © 2005 Microsoft Corporation.
All rights reserved.