# EsbCopyObject

Description

EsbCopyObject() copies an object on the server or client object system.

Syntax

    EsbCopyObject (hCtx, hDestCtx, ObjType, AppName, nAppName, DbName, nDbName,
    objName, nobjName)

    ByVal hCtx     As Long
    ByVal hDestCtx As Long
    ByVal ObjType  As Long
    ByVal AppName  As String
    ByVal nAppName As String
    ByVal DbName   As String
    ByVal nDbName  As String
    ByVal objName  As String
    ByVal nObjName As String

Parameters

hCtx | Essbase VB API context handle for source object. Can be local context handle returned by EsbCreateLocalContext().
hDestCtx | Essbase VB API context handle for destination object.
ObjType | Object type (must be single type). Refer to Bitmask Data Types for a list of possible values.
AppName | Source application name.
nAppName | Destination application name.
DbName | Source database name. If an empty string, uses the source application sub-directory.
nDbName | Destination database name. If an empty string, uses the destination application sub-directory.
objName | Name of a source object to copy from.
nobjName | Name of a destination object to copy to. Object names can be 8 characters long, and can contain all special characters allowed in DOS file names. No spaces, commas, backslashes, or periods are allowed.

Return Value

None.

Notes

- Objects may be copied from client to server, server to client, within the same server, or between different servers. 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 EsbCopyDatabase() 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 (ESB_PRIV_APPDESIGN or ESB_PRIV_DBDESIGN) for the specified destination application or database.

Example

    Declare Function EsbCopyObject Lib "ESBAPIW" (ByVal hCtx As Long, ByVal hDestCtx As Long, ByVal ObjType As Integer, ByVal SrcApp As String, ByVal DestApp As String, ByVal SrcDb As String, ByVal DestDb As String, ByVal SrcObj As String, ByVal DestName As String) As Long

    Sub ESB_CopyObject ()
       Dim sts As Long
       Dim hDestCtx As Long
       Dim SrcApp As String
       Dim SrcDb As String
       Dim SrcObj As String
       Dim DestApp As String
       Dim DestDb As String
       Dim DestObj As String
       Dim ObjType As Integer

       hDestCtx = hCtx
       SrcApp = "Sample"
       SrcDb = "Basic"
       SrcObj = "Basic"
       DestApp = "NewSamp"
       DestDb = "NewBasic"
       DestObj = "NewBasic"
       ObjType = ESB_OBJTYPE_RULES

       '******************
       ' Copy rules object
       '******************
       sts = EsbCopyObject (hCtx, hDestCtx, ObjType,
       SrcApp, DestApp, SrcDb, DestDb, SrcObj,
       DestObj)
    End Sub

See Also

EsbCreateObject()
EsbDeleteObject()
EsbListObjects()
EsbRenameObject()
EsbLockObject()