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;
}