ACAPI_​ElementList_​AddProperty

Makes a property definition available for all of given elements (it is created if it does not exist).

    GSErrCode  ACAPI_ElementList_AddProperty (
        API_PropertyDefinition&        definition,
        const GS::Array<API_Guid>&     elemGuids
    );

 

Parameters

definition
[in] The GUID of the definition (if already existing) or the data of the definition to create.
[out] The GUID of the definition (if newly created) and the modified availability array.
elemGuids
[in] The array of elements, that the property should be available for.

 

Return Values

NoError
The function has completed with success.
APIERR_BADID
The groupGuid of the parameter did not refer to a valid property group or one of the availabilities’ guid did not refer to a valid structural type category value or one of elemGuids did not refer to a valid element.
APIERR_NOACCESSRIGHT
Do not have the right to create or modify a property definition on a teamwork server.
APIERR_NAMEALREADYUSED
The name of the definition is already used in the given property group.
APIERR_BADPARS
The value of the definition is inconsistent, for example the default value has a different value type than the definition itself.
APIERR_BADVALUE
One of enumerations did not have their value out of the allowed ones. This includes c++ enums (i.e. they were uninitialized or memsetted), and enumeration property values (the possibleEnumValues doesn’t contain the default value)

For other common API errors see the API Errors document.

 

Example



GSErrCode CreateExamplePropertyDefinitionForSelection (API_Guid groupGuid, const GS::Array<API_Guid>& selectedElements, API_PropertyDefinition& definition)
{
    definition.guid = APINULLGuid;
    definition.groupGuid = groupGuid;
    definition.name = "Property Definition";
    definition.description = "An example property definition.";
    definition.collectionType = API_PropertySingleCollectionType;
    definition.valueType = API_PropertyBooleanValueType;
    definition.defaultValue.singleVariant.variant.type = definition.valueType;
    definition.defaultValue.singleVariant.variant.boolValue = false;

    return ACAPI_ElementList_AddProperty (definition, selectedElements);
}

        
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