I have a Main folder(mf) name as 030 Main, which has folders(f), subfolders(sf) and Components(c)like below. mf- main foler,f- folder, c-component. just to make simple, if c is present how should i get immediate f name(i.e folder name).

For example like below

100 Africa(f)-->110 Somalia(sf)-->010 Play(c),020 overview(c),030 Beach(c) 120 India(f) -->110 Pune(sf) -->010 Play(c),020 Station(c),030 Fishing(c) 120 India(f) -->110 Kerala(sf) -->010 Play(c),020 Station(c),030 Beach(c),040 flight(c)

There are also some components within 030 Main.

Now I want to retrieve some content only from Beach components. Along with it i want immediate subfolder name.i.e(if beach is present need respective city names also like somalia,kerala). I tried below, First used component filter and then fetched all the components, then checked for" 030 Beach " then get content. Now i want folder name which has " 030 Beach " component.

OrganizationalItemItemsFilterData filter = new OrganizationalItemItemsFilterData();
            filter.ItemTypes = new[] { ItemType.Component };
            filter.Recursive = true;

 foreach (var id in client.GetListXml(folder, filter).Elements().ToList())
                  string compTitle=id.Attribute("Title").Value;
                  string compId = id.Attribute("ID").Value;

                  StringBuilder sb = new StringBuilder();
                  if (compTitle.Equals("030 Beach"))

                       ComponentData component1 = client.Read(compId, new ReadOptions()) as ComponentData;
                        var componentContent = component1.Content;


  • 1
    Hi Rachel, In your question I am not able to see exact issue you are facing. Can you edit your question to specify the issue you are facing. Dec 30, 2015 at 6:35
  • It looks like you are trying to classify resorts by the facilities they have. This might be easier to do using Keywords. Dec 30, 2015 at 9:11

1 Answer 1


Once you get the ComponentData object you can access the property LocationInfo to access the repository object (Folder) where the component is located

You can retrieve the folder name by adding this line to you code:

string componentsOrganizationalItem = component1.LocationInfo.OrganizationalItem.Title;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.