# EssOtlRenameMember

Description

EssOtlRenameMember() renames a member.

Syntax

    ESS_FUNC_M EssOtlRenameMember (hOutline, hMember, pszNewMember);

ESS_HOUTLINE_T | hOutline
ESS_HMEMBER_T | hMember
ESS_STR_T | pszNewMember

Parameters

hOutline | Outline context handle
hMember | Handle of member to rename
pszNewMember | New member name

Return Value

Returns 0 if successful; otherwise one of the following:

OTLAPI_BAD_MBRNAME
OTLAPI_BAD_RENAMESHARE
OTLAPI_ERR_RENAMENAMEUSED

Notes

- All shared members are also renamed.
- This call fails if the hMember parameter points to a shared member.
- Renaming a zero-level (leaf node) attribute member that is not of type ESS_ATTRMBRDT_STRING resets the following:
  - the attribute value
  - the member's long name, using the specifications for the outline in the ESS_ATTRSPECS_T structure
- Renaming an ancestor may affect the long name of a zero-level attribute member.

Example

    #include <essapi.h>
    #include <essotl.h>

    ESS_STS_T          sts = 0;
    ESS_OBJDEF_T       Object;
    ESS_HOUTLINE_T     hOutline;
    ESS_HMEMBER_T      hMemberJan;
    ESS_APPNAME_T      szAppName;
    ESS_DBNAME_T       szDbName;
    ESS_OBJNAME_T      szFileName;

    memset(&Object, '\0', sizeof(Object));
    Object.hCtx = hCtx;
    Object.ObjType = ESS_OBJTYPE_OUTLINE;
    strcpy(szAppName, "Sample");
    strcpy(szDbName, "Basic");
    strcpy(szFileName, "Basic");
    Object.AppName = szAppName;
    Object.DbName = szDbName;
    Object.FileName = szFileName;

    sts = EssOtlOpenOutline(hCtx, &Object, ESS_TRUE,
         ESS_TRUE, &hOutline);

    if (!sts)
    {
       sts = EssOtlFindMember(hOutline, "Jan",
             &hMemberJan);
    }

    if (!sts && hMemberJan)
    {
       sts = EssOtlRenameMember(hOutline, hMemberJan,
             "January prelim");
    }

See Also

EssOtlFindMember()
EssOtlMoveMember()
EssOtlAddMember()
EssOtlDeleteMember()