ACAPI_​Element_​SetPropertiesDefault

Sets the specified properties for the given values on an element default.

    GSErrCode  ACAPI_Element_SetPropertiesDefault (
        API_ElemTypeID                     typeID,
        API_ElemVariationID                variationID,
        const GS::Array<API_Property>&     properties
    );

 

Parameters

typeID
[in] Type of the default element.
variationID
[in] The element variation that distinguishes the element kinds of the same type.
properties
[in] Specifies the properties to be set.

 

Return Values

NoError
The function has completed with success.
APIERR_BADID
Incorrect typeID or variationID 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_BADPROPERTYFORELEM
The property definition is not available for the given element.

For other common API errors see the API Errors document.

 

Example



GSErrCode SetAllPropertyValuesToDefault (API_ElemTypeID typeId, API_ElemVariationID variationID)
{
    GS::Array<API_PropertyDefinition> definitions;
    GSErrCode error = ACAPI_Element_GetPropertyDefinitionsDefault (typeId, variationID, 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_Element_GetPropertiesDefault (typeId, variationID, properties);
        if (error == NoError) {
            for (UInt32 i = 0; i < properties.GetSize (); i++) {
                properties[i].isDefault = true;
            }
            error = ACAPI_Element_SetPropertiesDefault (typeId, variationID,  properties);
        }
    }

    return error;
}

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

 

Requirements

Version: API 20 or later
Header: ACAPinc.h

 

See Also

Properties,
API Functions