Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Root categories - Categories with no parent
Pickels
#1 Posted : Friday, July 09, 2010 10:53:49 AM(UTC)
Rank: Advanced Member
Groups: Registered

Joined: 9/8/2009(UTC)
Posts: 91
Location: Belgium
Hello,

is there a better way to find which items don't have a category themself?

Code:

var categories = CmsContext.ContentService.GetContentsByFolder("Categories");

foreach (var category in categories)
{
//Finds root categories
var parent = category.GetCategoriesByContentAndFolder("categories");
if (!parent.Any())
{
//Root item found!
}
}
jifeng
#2 Posted : Friday, July 09, 2010 6:57:05 PM(UTC)
Rank: Administration
Groups: Administrators, Registered

Joined: 9/3/2009(UTC)
Posts: 1,394
Location: Xiamen China
I do not know of a better way.
Regards,

Jifeng Huang

Kooboo Team

Microsoft ASP.NET MVP
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.038 seconds.