Quick question. I'm building a Template Building Block (TBB) that retrieves metadata schema values from the parent folder of components. For example, all of the components listed in this folder will share the same title, but have different content. So, I created a schema and attached it to the parent folder. This way, if I want to change the title of all my components, all I have to do is change the metadata value on the folder.
I have this working with the parent folder TCM hard-coded, but, I need to grab this dynamically. Does anyone know how to grab the parent folder's TCM?
Thank you for your assistance.
RepositoryLocalObjects all have a ".OrganizationalItem" property that will return the container for the object.
Something along these lines should get you started:
Component component = (Component)engine.GetObject(package.GetByName(Package.ComponentName));
Folder parent = (Folder)component.OrganizationalItem;
ItemFields folderFields = new ItemFields(parent.Metadata, parent.MetadataSchema);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With