ACAPI_​Element_​SetPropertyOfDefaultElem

Sets the specified property to the given value on an element default.

    GSErrCode  ACAPI_Element_SetPropertyOfDefaultElem (
        const API_ElemType&   type,
        const API_Property&   property
    );

 

Parameters

type
[in] Type of the default element.
property
[in] Specifies the property to be set.

 

Return Values

NoError
The function has completed with success.
APIERR_BADID
Incorrect type 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 element 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 element.

For other common API errors see the API Errors document.

 

Remarks

New in API 26 From version 26 the typeID and variationID parameters were merged into a single API_ElemType parameter.

 

Example



GSErrCode SetFirstPropertyValueToDefault (const API_ElemType& type)
{
    GS::Array<API_PropertyDefinition> definitions;
    GSErrCode error = ACAPI_Element_GetPropertyDefinitionsOfDefaultElem (type, API_PropertyDefinitionFilter_UserDefined, definitions);
    if (error == NoError) {
        GS::Array<API_Property> properties;
        error = ACAPI_Element_GetPropertyValuesOfDefaultElem (type, definitions, properties);
        if (error == NoError) {
            API_Property property = properties[0];
            property.isDefault = true;

            error = ACAPI_Element_SetPropertyOfDefaultElem (type, property);
        }
    }

    return error;
}
        
For more detailed examples, please see the Property_Test add-on.

 

Requirements

Version: API 22 or later
Header: ACAPinc.h

 

See Also

Properties,
API Functions