COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => SDK => Topic started by: parkh2 on 17 Oct 2014 12:44:53 PM

Title: List all packages in root of cognos environment
Post by: parkh2 on 17 Oct 2014 12:44:53 PM
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;
        }
Title: Re: List all packages in root of cognos environment
Post by: parkh2 on 17 Oct 2014 01:05:53 PM
Nevermind figured it out. Just have to put "content" in front of "/package". 
Title: Re: List all packages in root of cognos environment
Post by: fulekia on 20 Oct 2014 08:53:37 AM
I'd be interested to hear how this works for you. I tried the same thing with reports (see SearchPathMultipleObject weirdness (http://www.cognoise.com/index.php/topic,26188.0.html)), but the results aren't always complete. It's like it doesn't always recurse into all sub-directories or something.