# oamCloseObject

Ends the editing session for a managed object, validating and saving changes.

#### Prototype

DWORD oamCloseObject ( HMOBJ hObject )

Argument | Description
hObject | [in] Handle of managed object to close (returned by oamOpenObject).

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_HANDLE | hObject is invalid.
CTAERR_SVR_COMM | Natural Access Server is not running.
OAMERR_ACCESS_DENIED | Object is not open.
OAMERR_ALREADY_EXISTS | Attempt to rename or renumber to a value already in use.
OAMERR_FILE_WRITE_ERROR | Error writing to database.
OAMERR_NOT_ENOUGH_MEMORY | Memory allocation error.
OAMERR_NOT_FOUND | Object not found (hObject invalid).
OAMERR_SERVER_NOT_RUNNING | Supervisor is shut down.

#### Details

oamCloseObject closes a managed object previously opened by oamOpenObject.

In addition to the return values previously listed, this function can return keyword validation errors specific to the type of managed object being closed. For more information about these errors, refer to the documentation for the managed component.

For more information about opening and closing objects, see Accessing configuration data.

#### Example

DWORD closeObject( CTAHD ctahd, HMOBJ objHd )
{
DWORD ret;
/* Close a handle to a previously opened managed object */
if ( ( ret = oamCloseObject( objHd ) ) != SUCCESS )
{
char errMsg[ 100 ];
ctaGetText( ctahd, ret, errMsg, sizeof(errMsg) );
printf("oamCloseObject failed: %s\n", errMsg );
}
return ret;
}