/// <summary> /// Returns the list of structure groups of the current publication. /// </summary> /// <remarks> /// This call is expensive, as each object must be retrieved from the underlying layers separately. /// For a cheaper alternative (with less functionality) you should consider <c>GetListStructureGroups</c> /// </remarks> /// <returns>the list of structure groups of the current publication</returns> /// <seealso cref="StructureGroup"/> /// <seealso cref="GetListStructureGroups"/> protected IList <StructureGroup> GetStructureGroups() { CheckInitialized(); Publication publication = GetPublication(); Filter sgFilter = new Filter(); sgFilter.Conditions["ItemType"] = ItemType.StructureGroup; OrganizationalItemsFilter filter = new OrganizationalItemsFilter(sgFilter, m_Engine.GetSession()); return(GetObjectsFromXmlList <StructureGroup>(m_Engine, publication.GetListOrganizationalItems(filter))); }
/// <summary> /// Returns the list of structure groups of the current publication. /// </summary> /// <remarks> /// This call is expensive, as each object must be retrieved from the underlying layers separately. /// For a cheaper alternative (with less functionality) you should consider <c>GetListStructureGroups</c> /// </remarks> /// <returns>the list of structure groups of the current publication</returns> /// <seealso cref="StructureGroup"/> /// <seealso cref="GetListStructureGroups"/> protected IList <StructureGroup> GetStructureGroups() { CheckInitialized(); Publication publication = GetPublication(); //Filter sgFilter = new Filter(); //sgFilter.Conditions["ItemType"] = ItemType.StructureGroup; OrganizationalItemsFilter sgFilter = new OrganizationalItemsFilter(publication.Session) { ItemTypes = new List <ItemType> { ItemType.StructureGroup } }; return(GetObjectsFromXmlList <StructureGroup>(MEngine, publication.GetListOrganizationalItems(sgFilter))); }
/// <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); }