oamSetKeyword

Sets a keyword for a managed object.

Prototype

DWORD oamSetKeyword ( HMOBJ hObject, const char *szKeyword, const char *szValue )

Argument

Description

hObject

[in] Handle to the managed object.

szKeyword

[in] Pointer to the name of keyword.

szValue

[in] Pointer to a buffer containing keyword value to set.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

szValue or szKeyword is NULL or 0.

CTAERR_INVALID_HANDLE

hObject is invalid.

CTAERR_SVR_COMM

Natural Access Server is not running.

OAMERR_ACCESS_DENIED

hObject is not open for writing.

OAMERR_NOT_ENOUGH_MEMORY

Memory allocation error.

OAMERR_NOT_FOUND

szKeyword not found.

OAMERR_SERVER_NOT_RUNNING

szKeyword not found.


Note: Other object-specific keyword validation errors can also occur. For more information about these errors, refer to the documentation for the managed component.

Details

If the managed object was opened in OAM_READWRITE mode, oamSetKeyword sets the value of a keyword. oamSetKeyword does not create the keyword if it does not exist; otherwise it returns an error. For more information about modes, see oamOpenObject.

See also

oamGetKeyword, oamGetQualifier

Example

DWORD setKeyword( CTAHD ctahd, HMOBJ objHd, char *pKeyword, char *value )
{
    DWORD ret;

    /* Set the value of the passed in keyword. The managed object
    *  has previously been opened in OAM_READWRITE mode and a handle 
    *  to it (objHd) has been provided.
    */
    ret = oamSetKeyword( objHd, pKeyword, value );
   
    if ( ret != SUCCESS )
    {
        char errMsg[ 100 ];

        ctaGetText( ctahd, ret, errMsg, sizeof(errMsg) );
        printf("oamSetKeyword failed: %s\n", errMsg );
    }

    return ret;
}