Description

Set or retrieve the value of a particular attribute.

Property type

A Variant value.  

Syntax

object.Item(Name, [Format]) [= value]

The Item Property syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McDBAttributes.
NameRequired. A String value.

The name of the attribute to retrieve or set the value of.

FormatOptional. A mcDBDataStyle enumeration, as described in settings.

The form of the data to be retrieved, when more than one option is available. The Format mcdbGlobalID will yield a globally unique identifier for any attribute. When the requested attribute is of McDBAttributeType.Type mcdbEnum this parameter determines whether a long or string value is returned. If its McDBAttributeType.Type is mcdbObject, Format indicates the mcDBDataStyle used to return the requested attribute. All values except mcdbGlobalID are ignored when the requested attribute is of any other type, and always ignored when assigning a value. If an invalid value is passed for this parameter, when applicable, the default value for each type is used (mcdbStringData for McDBAttributeType.Type mcdbEnum and mcdbActualObject for type mcdbObject).

valueA Variant value.

Settings

The settings for Format are:

ConstantValueDescription
 mcdbNoData0
 mcdbDefaultStyle1
 mcdbStringData1

value as a string

 mcdbStorage2

returned object implements IStream

 mcdbStream3

returned object implements IStorage

 mcdbBytes4

raw byte stream of object

 mcdbProgId5

the ProgID of the stored object

 mcdbLongData6

value as a Long (for mcdbEnum attributes only)

 mcdbGlobalID7

A database-global identifier of the object

 mcdbActualObject16

An IDispatch to the object, can be Ored with mcdbStorage and mcdbStream

Remarks

This property/method will return an empty variant if no attribute with the given Name exists in this collection (i.e. in the owning McDBNode.Attributes). Assigning a value fires the NodeModified event, if it being monitored.

Exceptions

Error Value Description
E_UNEXPECTED &H8001FFFF A framework error occured assigning or retrieving the McDBAttribute.
E_INVALIDARG &H80070057 When retrieving, Name does not specify a defined attribute in the McDBType.Attributes of the McDBNode.Type of the McDBNode that owns this collection. When assigning, the value is not of a compatible type with the McDBAttributeType.Type of the attribute being assigned.
E_ACCESSDENIED &H80070005 The McDBDatabase.LoggedUser does not have write access to the McDBNode that owns this collection.
E_FAIL &H80004005 The value could not be written; possibly because of database corruption.
E_NOTIMPL &H80004001 The McDBAttributeType.Type of the attribute is mcdbOther, and the attribute cannot be instantiated by McDBLib.
STG_E_NOMOREFILES &H80030012 The BLOB in the requested attribute is corrupted.

Notes

Attributes may not be retrieved by numeric index. Objects of type mcdbObject that are retrieved as IStorage or IStream objects will lose their backing COM object once all references to its McDBAttributes object and associated McDBNode object are released. Attributes of type mcdbEnum may be assigned either by string or numeric value. However, numeric values must be long, and may need to be explicitly cast (i.e. using the CLng function).