I am trying to get the Components based on a specific Schema in my TBB. But every time it is returning all the Components created under Building Blocks
. I am putting my code below. Any help will be really appreciated
Page page = _utilities.GetPage();
Publication publication = GetPublication(page);
Component component = page.ComponentPresentations[0].Component;
Schema videoSchema = component.Schema;
var filter = new OrganizationalItemItemsFilter(_engine.GetSession());
filter.Recursive = true;
filter.ItemTypes = new[] { ItemType.Component };
filter.BasedOnSchemas = new[] { videoSchema };
filter.ComponentTypes = new[] { ComponentType.Normal };
var testComponents = publication.RootFolder.GetItems(filter);