If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

List all packages in root of cognos environment

Started by parkh2, 17 Oct 2014 12:44:53 PM

Previous topic - Next topic

parkh2

How would I go about listing all the packages in the root folder of my cognos environment? I have code that lists all the packages in my cognos environement, but its listing all the packages within those packages as well.  Any ideas? Or can someone point me to the documentation that explains doing this?


private static List<CognosPackage> GetPackageList(contentManagerService1 cognos, propEnum[] props, sort[] s, queryOptions qo, string searchPath)
        {
            string path = searchPath + "/package";
            searchPathMultipleObject foldersSearchPath = new searchPathMultipleObject();
            foldersSearchPath.Value = path;
            baseClass[] bcFolders = cognos.query(foldersSearchPath, props, s, qo);

            List<CognosPackage> packages = new List<CognosPackage>();

            for (int i = 0; i < bcFolders.Length; i++)
            {
                if (bcFolders[i].permissions.value.Length > 0)
                {                   
                    CognosPackage c = new CognosPackage();
                    c.searchPath = bcFolders[i].searchPath.value;
                    c.name = bcFolders[i].defaultName.value;
                    packages.Add(c);
                }
            }
            return packages;
        }

parkh2

Nevermind figured it out. Just have to put "content" in front of "/package". 

fulekia

I'd be interested to hear how this works for you. I tried the same thing with reports (see SearchPathMultipleObject weirdness), but the results aren't always complete. It's like it doesn't always recurse into all sub-directories or something.