Cognos SDK Guide by BI Centre can be purchased from PayPal.

You will have your own functional Cognos 8 SDK web solution that has been tailored to be scalable and flexible in order to adapt to your unique business requirements and solution architecture.


Thursday, January 3, 2008

CognosSDK.cs -- Request Content Store Objects

The Cognos Content Store contains the metadata representation of items such as reports, query items, report views, and security settings. The Cognos SDK code can call the Content Manager’s .query() method to search for and retrieve Content Store items. The getObjects() method is an example of searching the Content Store and finding either all Content Store package items or all report items for a specified package.

public baseClass[] getObjects(contentManagerService1 _cmService, string _path, string _package)

{
propEnum[] _props = new propEnum[]{propEnum.searchPath,propEnum.defaultName,propEnum.objectClass, propEnum.modificationTime, propEnum.connectionString, propEnum.creationTime, propEnum.link, propEnum.specification, propEnum.version, propEnum.defaultName, propEnum.portalPages, propEnum.ancestors, propEnum.owner};



if(_cmService != null)

{

sort[] _sort = {new sort()};

_sort[0].order=orderEnum.ascending;

_sort[0].propName=propEnum.defaultName;



_packagePath = "/content//package/*";

_reportPath = "/content/package[@name='" + _package + "']/report//*";



searchPathMultipleObject _spMulti = new searchPathMultipleObject();



if (_path == "packageConfiguration")

{

_path = _packagePath;

}

else if (_path == "report")

{

_path = _reportPath;

}

else

{

_path = null;

}



_spMulti.Value = _path;



try

{

//Query Cognos 8 and return the Base Class Array to the calling method

baseClass[] _bc = _cmService.query(_spMulti, _props, _sort, new queryOptions());

if(_bc != null)

{

//if the search request returned results

if(_bc.Length > 0)

{

return _bc;

}

else

{

return null;

}

}

}





catch(Exception ex)

{

_ErrMsg = ex.Message.ToString();

return null;

}

}



//no results found

return(null);

}