ACAPI_​TeamworkControl_​ReserveLockable

Reserves a lockable object set in Teamwork mode.

    GSErrCode  ACAPI_TeamworkControl_ReserveLockable (
        const API_Guid&                    objectId,
        GS::PagedArray<short>*     conflicts = nullptr,
        bool                               enableDialogs = true
    );

 

Parameters

objectId
[in] Unique identifier of the lockable object set
conflicts
[out] List of conflicting users (optional, can be nullptr or omitted)
enableDialogs API version 22
[in] Show dialogs during the process? (optional, by default the dialogs are enabled)

 

Return Values

NoError
The function has completed with success.
APIERR_NOPLAN
There is no open project.
APIERR_NOTEAMWORKPROJECT
The current project is not Teamwork project.
APIERR_BADID
The given objectId is not a valid lockable object set identifier.
APIERR_SERVICEFAILED
The lock cannot be obtained, or the operation has failed due to communication or server error.

For other common errors see the list of error codes.

 

Remarks

This function is used to reserve a lockable object set in Teamwork mode.

Before reserving a lockable object set, make sure that the current user has sufficient privileges to edit the object set (ACAPI_TeamworkControl_HasDeleteModifyRight). It is recommended to check the locking status also before reservation (ACAPI_TeamworkControl_GetLockableStatus).

Do not forget to release the lockable object set when reservation is not needed any more.

This function is a non-undoable data structure modifier function. See more details on this topic at Command Overview.

 

Example


API_Guid objectSetGuid = ACAPI_TeamworkControl_FindLockableObjectSet ("Profiles");
API_LockableStatus lockableStatus = ACAPI_TeamworkControl_GetLockableStatus (objectSetGuid);

if (lockableStatus == APILockableStatus_Free) {
    GSErrCode errCode = ACAPI_TeamworkControl_ReserveLockable (objectSetGuid);
    if (errCode == NoError)
        ACAPI_WriteReport ("Profile attributes has been reserved succesfully", true);
    else
        ACAPI_WriteReport ("Reservation of Profile attributes has failed", true);
} else if (lockableStatus == APILockableStatus_Editable) {
    ACAPI_WriteReport ("Profile attributes has already been reserved", true);
} else {
    ACAPI_WriteReport ("Profile attributes cannot be reserved at the moment", true);
}

 

Requirements

Version: API 13 or later
Header: ACAPinc.h

 

See Also

ACAPI_TeamworkControl_HasDeleteModifyRight
ACAPI_TeamworkControl_GetLockableStatus
ACAPI_TeamworkControl_ReleaseLockable
ACAPI_Notify_CatchLockableReservationChange
Teamwork Control
API Functions