In my c# tbb, I am trying to fetch all the components using the particular keyword in a publication context. The code which I am using is:
UsingItemsFilter filter = new UsingItemsFilter(pub.Session)
{
ItemTypes = new[] { ItemType.Component },
IncludedVersions = VersionCondition.OnlyLatestVersions
};
var classifiedComponents = keyword.GetListUsingItems(filter);
It's filtering all the components which is associated with the particular keyword (suppose i am picking any keyword from the lowest child publication). I assumed, it should be filtered only those components which are in publication hierarchy.
But not, its fetching all components which are also not in publication hierarchy.
Can anyone please suggest, how can i get only those components which are only associated from the publication hierarchy.