ACAPI_​Property_​CreatePropertyDefinition

Creates a property definition in the current plan.

    GSErrCode  ACAPI_Property_CreatePropertyDefinition (
        API_PropertyDefinition&      definition
    );

 

Parameters

definition
[in] The property definition to create.
[out] The guid field is overwritten with the id of the newly created property definition.

 

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.
APIERR_NOACCESSRIGHT
Do not have the right to create 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 CreateExamplePropertyDefinition (API_Guid groupGuid, 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_Property_CreatePropertyDefinition (definition);
}

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