I have a parent publication "A", where a category is created. Now several child publications are inherited from this parent publication A: keywords can be created in any of these child Publications.
What is the best approach to get a list of all keywords in the category, no matter in which Publication they are created? My starting point is the uri of the category in the Parent Publication (A), I have NO Publication context.
I'd prefer to get this solved with TOM.NET. Any ideas on the most optimal approach?
Some more backgrouund info: As part of an integration, keywords are automatically created (representing IDs on the system we integrate with). The keywords are created in the child Publications where the Components (that use this ID) are created.
I would like to have this list of all keywords to:
- Report (and automatically remove) unused keywords
- Easily query on this custom ID on the CMS (without using search !)
Based on your comments, this is the most optimized way to get all keywords in all Blueprinted categories. A bit more work is required to get it all in a joined list, but this works for me now.
Tridion.ContentManager.Session session = new Tridion.ContentManager.Session(User.Identity.Name);
Category parentCat = (Category)session.GetObject(categoryWebdavUrl);
SystemManager systemManager = session.SystemManager;
BluePrintFilter bf = new BluePrintFilter(session)
{
BaseColumns = ListBaseColumns.Id,
ForItem = parentCat
};
foreach (BluePrintNode node in systemManager.GetBluePrintNodes(bf))
{
var item = node.Item;
if (item is Category)
{
Category cat = (Category)item;
foreach (Keyword keyw in cat.GetKeywords())
{
try
{
// Perform magic here
}
catch { }
}
}
}