ACAPI_​Attribute_​SetProperties

Sets the specified built-in properties for the given values on an attribute.

    GSErrCode  ACAPI_Attribute_SetProperties (
        const API_Attr_Head&               attrHead,
        const GS::Array<API_Property>&     properties
    );

 

Parameters

attrHead
[in] Header of the attribute. The attribute is identified by typeID and index
properties
[in] Specifies the properties to be set.

 

Return Values

NoError
The function has completed with success.
APIERR_BADID
Incorrect attributeTypeID or attributeIndex was specified or one of the property definitions’ guid did not refer to a valid object.
APIERR_NOACCESSRIGHT
The current user does not have the right to modify the properties of the specified attribute on a teamwork server.
APIERR_READONLY
Tried to modify a read-only property (for example a property coming from a hotlink).
APIERR_BADPROPERTY
The property definition is not available for the given attribute.

For other common API errors see the API Errors document.

 

Example


GSErrCode SetAllPropertyValuesToDefault (API_AttrTypeID attributeTypeID, short attributeIndex)
{
    API_Attr_Head                     attributeHeader;
    GS::Array<API_PropertyDefinition> definitions;

    BNZeroMemory (&attributeHeader, sizeof (API_Attr_Head));
    attributeHeader.typeID = attributeTypeID;
    attributeHeader.index = attributeIndex;
	
    GSErrCode error = ACAPI_Attribute_GetPropertyDefinitions (attributeHeader, definitions);
    if (error == NoError) {
        GS::Array<API_Property> properties;
        for (UInt32 i = 0; i < definitions.GetSize (); i++) {
            API_Property property;
            property.definition = definitions[i];
            properties.Push (property);
        }

        error = ACAPI_Attribute_GetProperties (attributeHeader, properties);
        if (error == NoError) {
            for (UInt32 i = 0; i < properties.GetSize (); i++) {
                properties[i].isDefault = true;
            }
            error = ACAPI_Attribute_SetProperties (attributeHeader, properties);
        }
    }

    return error;
}

        
For more detailed examples, please see the Property_Test add-on.

 

Requirements

Version: API 23 or later
Header: ACAPinc.h

 

See Also

Properties,
API Functions