ICatalogManager3::AddPropertyValue Method [C++]

Use this method to add a value to the list of defined values for the specified enumeration.

Definition

[C++]

HRESULT ICatalogManager3::AddPropertyValue(BSTRstrPropertyName,
  BSTRstrLegalValueBSTRstrLang);

[Visual Basic]

Sub AddPropertyValue(strPropertyName As String,
  strLegalValue As StringOptional strLang As String)

Parameters

  • strPropertyName[C++]
    [in] A BSTR that contains the name of the enumeration property for which a new value will be defined.
  • strPropertyName[Visual Basic]
    A String that contains the name of the enumeration property for which a new value will be defined.
  • strLegalValue[C++]
    [in] A BSTR that contains the new value.
  • strLegalValue[Visual Basic]
    A String that contains the new value.
  • strLang[C++]
    [in, optional] A BSTR that contains the culture name. The language 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.
  • strLang[Visual Basic]
    A String that contains the 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.

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.

Name Value Description
E_CAT_CATMGR_NOT_INITIALIZED

[C++] 0x889800B

[Visual Basic] &H8898005

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

[C++] 0x889800B

[Visual Basic] &H8898006

The input parameter <parameter number> is invalid.
E_CAT_INVALID_PROPERTY_NAME

[C++] 0x889800A

[Visual Basic] &H8898002

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_INVALID_ENUMERATED_VALUE

[C++] 0x889800E

[Visual Basic] &H8898009

The value you specified for the enumerated property exceeds 128 characters
E_CAT_INVALID_LANGUAGE

[C++] 0x8898009

[Visual Basic] &H889800E

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

[C++] 0x8898000

[Visual Basic] &H8898005

The property name you specified does not exist.
E_CAT_PROP_NOT_ENUM

[C++] 0x8898000

[Visual Basic] &H8898007

The property you specified is not a cscEnumeration data-type. This operation can only be performed on cscEnumeration data types.
E_CAT_VALUE_ALREADY_ADDED

[C++] 0x8898000

[Visual Basic] &H8898008

The enumerated value you specified is already present in the list for this property.

[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

The AddPropertyValue method is used only for properties whose data type is cscEnumeration.

This method adds a new value to the list of defined values for an enumeration property. Any attempts by a client to set this property to a value other than one of the legal values will result in an error. This method is useful for automatic validation against properties that only have a small, fixed set of values. For example, a Color property may have red, green, and blue as the only defined values.

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

[Visual Basic]

Example

myCatalogManager.AddPropertyValue "color", "Blue"

See Also

[C++]CatalogManager Object

[Visual Basic]CatalogManager Object

[C++]ICatalogManager3::GetPropertyValues

[Visual Basic]CatalogManager.GetPropertyValues

[C++]ICatalogManager3::RemovePropertyValue

[Visual Basic]CatalogManager.RemovePropertyValue

[C++]Table of Language Culture Names, Codes, and ISO Values

[Visual Basic]Table of Language Culture Names, Codes, and ISO Values

Copyright © 2005 Microsoft Corporation.
All rights reserved.