ICatalogManager::AddPropertyValue

Ee799661.c++_off(en-US,CS.10).gifEe799661.vb_on(en-US,CS.10).gif

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

Definition

HRESULT ICatalogManager::AddPropertyValue(BSTRstrPropertyName,BSTRstrLegalValue);

Parameters

strPropertyName

[in] A BSTR that contains the name of the enumeration property for which a new value will be defined.

strLegalValue

[in] A BSTR that contains the new value.

Return Values

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

Error Values

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.

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

Constant Value Description
E_CAT_PROP_DOESNT_EXIST 0x88980005 The property you specified did not exist.
E_CAT_PROP_NOT_ENUM 0x88980007 The property you specified was not of type cscEnumeration.
E_CAT_VALUE_ALREADY_ADDED 0x88980008 The enumeration value you specified was already present in the list.
OLE_E_BLANK 0x80040007 The object was not initialized. The Initialize method must be called before calling any other method.

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.

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.

See Also

CatalogManager Object

ICatalogManager::GetPropertyValues

ICatalogManager::RemovePropertyValue


All rights reserved.