APIEnv_​UserWorkspaceID

Returns the workspace data of a client of a TeamWork project.

    GSErrCode ACAPI_Environment (
      APIEnv_UserWorkspaceID,
      API_WorkspaceInfo     *workspaceInfo,
      short                 *userID,
      nullptr
    );

 

Parameters

workspaceInfo
Workspace data allocated for the member when signed in
userID
The member ID of the team client

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
any of the parameters are nullptr.
APIERR_NOPLAN
No open project.
APIERR_MEMFULL
Low memory condition.

For other common API errors see the API Errors document.

 

Remarks

This function is used to get workspace information of the current client. Since the API functions can access and modify the same portion of the database that the user can with the UI of Archicad, this information is very important.

The reserved stories, section/elevations, layers, camera paths, detail, worksheet and layout databases are returned. The function does not retrieve project components which are newly created by the client (implicitly added to the client’s workspace), but not sent yet into the team project (not registered in the project administration).

Do not forget to dispose the internal handles if they are not needed any more.

 

Example


API_WorkspaceInfo      workspaceInfo;
API_StoryInfo          storyInfo;
Int32                  i, ind;
char                   buffer[256];
short                  userId = 0;

BNZeroMemory (&workspaceInfo, sizeof (API_WorkspaceInfo));
GSErrCode err = ACAPI_Environment (APIEnv_UserWorkspaceID, &workspaceInfo, &userId, nullptr);
if (err == NoError) {
    ACAPI_WriteReport ("Stories:", false);
    if (workspaceInfo.nStories != 0) {
        BNZeroMemory (&storyInfo, sizeof (API_StoryInfo));
        ACAPI_Environment (APIEnv_GetStorySettingsID, &storyInfo, nullptr, nullptr);
        for (i = 0; i < workspaceInfo.nStories; i++) {
            ind = (*workspaceInfo.stories)[i];
            sprintf (buffer, "  [%3d] \"%s\"", ind, (*storyInfo.data)[ind - storyInfo.firstStory].name);
            ACAPI_WriteReport (buffer, false);
        }
        BMKillHandle ((GSHandle *) &storyInfo.data);
    }
}

BMKillHandle ((GSHandle *) &workspaceInfo.stories);
BMKillHandle ((GSHandle *) &workspaceInfo.layers);
BMKillHandle ((GSHandle *) &workspaceInfo.sections);
BMKillHandle ((GSHandle *) &workspaceInfo.camSets);
BMKillHandle ((GSHandle *) &workspaceInfo.details);
BMKillHandle ((GSHandle *) &workspaceInfo.worksheets);
BMKillHandle ((GSHandle *) &workspaceInfo.layouts);
BMKillHandle ((GSHandle *) &workspaceInfo.marquee.coords);

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Environment.h

 

See Also

API_WorkspaceInfo
ACAPI_Environment, API Functions