• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

Get a CategoryList through typed list providers

Some tooltip text!
• 2 minutes to read
 • 2 minutes to read

In the SoList class, there are specific methods to create different types of list providers. Hence there is a method specialized in creating CategoryList providers too.

The following example shows how to get a category list using typed list providers.

using SuperOffice;
using SuperOffice.CRM.Lists;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
  ISoListProvider categoryList = SoLists.GetCategoryList();
  //Retrieving the History items of the AssociateList
  if (categoryList.HistoryItems.Count > 0)
  {
    foreach (ISoListItem item in categoryList.HistoryItems)
    {
      string historyString;
      historyString = item.Id + " " + item.Name;
      HistoryListView.Items.Add(historyString);
    }
  }
  //Retrieving the HeadingItems of the AssociateList
  if (categoryList.HeadingItems.Count > 0)
  {
    foreach (ISoListHeading item in categoryList.HeadingItems)
    {
      string headingString;
      headingString = item.Heading.Id + " " + item.Heading.Name;
      HeadingListView.Items.Add(headingString);
    }
  }
  //Retrieving the RootItm
  if (categoryList.RootItems.Count > 0)
  {
    foreach (ISoListItem item in categoryList.RootItems)
    {
      string rootString;
      rootString = item.Id + " " + item.Name;
      RootListView.Items.Add(rootString);
    }
  }
}

By using the CategoryList method defined in the SoList class you can obtain a CategoryList provider.

There are 3 different items present in the CategoryList provider: HeadingItems, HistoryItems, and RootItems. Each of these items contains its own properties and in this example, we have used only the Id and the Name properties.

The HistoryItems are defined in the history table with its table_Id field referring to the conceptual table ID of the category table. Unless the MDO mode of the Contact list is turned on, no record will be added to the history table.

The RootItems are defined by the records in the category table only if the MDO mode is set to false. If the MDO mode is set to true then the RootItems contain only the items that have not been assigned to any Heading. Normally all the HeadingItems are taken directly from the heading table.

Output of the example:

Get a CategoryList through typed list providers -screenshot

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top