Hello,
I would also recommend you to take a look at the CMS API Examples (CMSSiteManager -> Support -> Api Examples -> Documents -> Categories) where you can find also the example code to create a categori:
private bool CreateCategory()
{
// Create new category object
CategoryInfo newCategory = new CategoryInfo();
// Set the properties
newCategory.CategoryDisplayName = "My new category";
newCategory.CategoryName = "MyNewCategory";
newCategory.CategoryDescription = "My new category description";
newCategory.CategorySiteID = CMSContext.CurrentSiteID;
newCategory.CategoryCount = 0;
newCategory.CategoryEnabled = true;
// Save the category
CategoryInfoProvider.SetCategoryInfo(newCategory);
return true;
}
Brandon's example is exactly the same just a little bit simplified.
Best regards,
Martin Danko