# EssListObjects

Description

EssListObjects() lists all objects of the specified types on the server or locally on the client.

Syntax

    ESS_FUNC_M EssListObjects (hCtx, ObjType, AppName, DbName, pCount, ppObjList);

ESS_HCTX_T | hCtx
ESS_OBJTYPE_T | ObjType
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_PUSHORT_T | pCount
ESS_PPOBJINFO_T | ppObjList

Parameters

hCtx | Essbase API context handle. Can be local context handle returned by EssCreateLocalContext().
ObjType | Object type (may be multiple types OR'ed together). Refer to Bitmask Data Types for a list of possible values.
AppName | Application name.
DbName | databasename. If NULL, lists objects in the application subdirectory.
pCount | Address of variable to receive the count of objects of the appropriate type(s).
ppObjList | Address of pointer to receive allocated array of object info structures.

Return Value

If successful, returns a count of the number of objects of the appropriate type(s) in pCount, and an array of matching object structures in ppObjList.

Notes

- The memory allocated for ppObjList should be freed using EssFree().

Access

This function requires no special privileges; note however that server objects will only be listed if the caller has the appropriate level of access to the application and/or database (depending on the object type).

Example

    ESS_FUNC_M
    ESS_ListObjects (ESS_HCTX_T  hCtx,
                     ESS_HINST_T hInst
                    )
    {
       ESS_FUNC_M         sts = ESS_STS_NOERR;
       ESS_POBJINFO_T    pObject, pNextObject = NULL;
       ESS_SHORT_T       objType = 0;
       ESS_USHORT_T      objCnt;
       ESS_USHORT_T      objInd;
       ESS_STR_T         AppName;
       ESS_STR_T         DbName;
       Appname = "Sample";
       DbName  = "Basic";
       objType = ESS_OBJTYPE_OUTLINE;
       sts = EssListObjects (hCtx, objType, AppName,
             DbName, &objCnt, &pObject);
       if (!sts)
       {
          if (objCnt && pObject)
          {
             pNextObject = pObject;
             for (objInd = 0; objInd < objCnt; objInd++)
             {
                 if (pNextObject)
                 {
    printf ("Name: %s \r\nUser: %s\r\nTime Stamp: %ld\r\n",
                             pNextObject->Name,
                             pNextObject->User,
                             pNextObject->TimeStamp);

                    pNextObject = pNextObject + 1;
                 }
             }
             EssFree (hInst, pObject);
          }
          else
    printf ("\r\nObject List is Empty\r\n\r\n");
       }
       return(sts);
    }

See Also

EssGetObject()
EssGetObjectInfo()