Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tridion 2009 - Retrieve Component's parent folder TCM

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.

like image 238
Helldozer Avatar asked Apr 17 '12 18:04

Helldozer


1 Answers

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);
like image 128
Nuno Linhares Avatar answered Nov 16 '22 08:11

Nuno Linhares