Hi,
Maybe there is a better way to find all the skills within a BusinessUnit, but here is some code i put together quickly.
It retrieves all folders with a type of '13' which are skill folders, it then iterates through the returned folders and tries to match the path the to a BusinessUnit, once it has found all matches it then retrieves the skills within those folders.
The sample code uses the COM Application Block..
[code] List<int> skillFolderDBIDs = new List<int>();
string path_to_businessUnit = "\\Configuration\\Environment\\TestConfigUnit";
//Get all folders for skills (Type 13)
CfgFolderQuery queryFolder = new CfgFolderQuery(confService);
queryFolder.Type = 13;
var folders = queryFolder.Execute();
foreach (CfgFolder folder in folders)
{
string s = folder.ParentID.ToString();
if (folder.ObjectPath.StartsWith(path_to_businessUnit))
{
//This is our Skills Folder in the BusinessUnit, add the DBID to our list
skillFolderDBIDs.Add(folder.DBID);
}
}
//Work through our list of skill folders and get the skills in those folders
foreach (int folder_dbid in skillFolderDBIDs)
{
CfgSkillQuery querySkill = new CfgSkillQuery(confService);
querySkill["folder_dbid"] = folder_dbid;
var skills = querySkill.Execute();
foreach (CfgSkill skill in skills)
{
log.Debug("Skill: " + skill.Name);
}
}[/code]