# EssCopyObject

Description

EssCopyObject() copies an object to the server or client object system.

Syntax

    ESS_FUNC_M EssCopyObject (hSrcCtx, hDestCtx, ObjType,
    SrcApp, DestApp, SrcDb, DestDb, SrcObj, DestObj);

ESS_HCTX_T | hCtx
ESS_OBJTYPE_T | ObjType
ESS_STR_T | SrcApp
ESS_STR_T | DestApp
ESS_STR_T | SrcDb
ESS_STR_T | DestDb
ESS_STR_T | SrcObj
ESS_STR_T | DestObj

Parameters

hSrcCtx | Essbase API context handle for source object. Can be local context handle returned by EssCreateLocalContext().
hDestCtx | Essbase API context handle for destination object. Can be local context handle returned by EssCreateLocalContext().
ObjType | Object type (must be single type). See Bitmask Data Types for possible values.
SrcApp | Source application name.
DestApp | Destination application name.
SrcDb | Source databasename. If NULL, uses the source application subdirectory.
DestDb | Destination databasename. If NULL, uses the destination application subdirectory.
SrcObj | Name of source object to copy from.
DestObj | Name of destination object to copy to.

Return Value

None.

Notes

- Objects may be copied from client to server, server to client, within the same server. In all cases the destination object must either not already exist or it must be locked by the caller.
- Outline objects cannot be copied. Use the EssCopyDatabase() function to copy a database, including its associated outline.

Access

This function requires the caller to have the appropriate level of access to the specified source application and/or database containing the object (depending on the object type), and to have Application or Database Design privilege (ESS_PRIV_APPDESIGN or ESS_PRIV_DBDESIGN) for the specified destination application or database.

Example

    ESS_FUNC_M
    ESS_CopyObject(ESS_HCTX_T hCtx)
    {
       ESS_FUNC_M         sts = ESS_STS_NOERR;
       ESS_HCTX_T        hDestCtx;
       ESS_STR_T         SrcApp;
       ESS_STR_T         DestApp;
       ESS_STR_T         SrcDb;
       ESS_STR_T         DestDb;
       ESS_STR_T         SrcObj;
       ESS_STR_T         DestObj;
       ESS_OBJTYPE_T     ObjType;

       hDestCtx  = hCtx;
       SrcApp    = "Sample";
       SrcDb     = "Basic";
       SrcObj    = "Test";
       DestApp   = "Sample";
       DestDb    = "Basic";
       DestObj   = "NewTest";
       ObjType   = ESS_OBJTYPE_TEXT;

       sts = EssCopyObject(hCtx,hDestCtx,ObjType,SrcApp,
             DestApp,SrcDb,DestDb,SrcObj,DestObj);

       if(!sts)
          printf("The Object is copied.\r\n");

       return (sts);
    }

See Also

EssCreateObject()
EssDeleteObject()
EssListObjects()
EssRenameObject()