Example #1
0
        /// <summary>
        /// Returns the list of structure groups of the current publication. This call is cheap, but the results
        /// are shallow.
        /// </summary>
        /// <remarks>
        /// Note that the objects returned are not TOM.NET StructureGroup objects, but a more shallow
        /// type of object. If you require the full functionality of TOM.NET StructureGroup objects, you should
        /// call the more expensive <c>GetStructureGroups</c> method.
        /// </remarks>
        /// <example>
        /// The results are unsorted. Sorting the result in place can be done with:
        /// <code>
        /// SGs.Sort(
        ///     delegate(ListItem item1, ListItem item2)
        ///     {
        ///         return item1.Title.CompareTo(item2.Title);
        ///     }
        /// );
        /// </code>
        /// </example>
        /// <returns>the list of structure groups of the current publication</returns>
        /// <seealso cref="ListItem"/>
        /// <seealso cref="GetStructureGroups"/>
        protected IList <ListItem> GetListStructureGroups()
        {
            CheckInitialized();
            Publication publication = GetPublication();
            Filter      sgFilter    = new Filter();

            sgFilter.Conditions["ItemType"] = ItemType.StructureGroup;
            sgFilter.BaseColumns            = ListBaseColumns.Extended;
            sgFilter.AdditionalColumns.Add("url");
            OrganizationalItemsFilter filter = new OrganizationalItemsFilter(sgFilter, m_Engine.GetSession());
            XmlElement orgItems = publication.GetListOrganizationalItems(filter);

            XmlNodeList     itemElements = orgItems.SelectNodes("*");
            List <ListItem> result       = new List <ListItem>(itemElements.Count);

            foreach (XmlElement itemElement in itemElements)
            {
                ListItem sg = new ListItem(itemElement);
                result.Add(sg);
            }

            return(result);
        }