5

I am using below code to get the set of elements using the particular component

   Filter filter = new Filter();
        filter.Conditions["ItemType"] = ItemType.Page;
        // Use the filter to get the Structure Groups contained in this root Structure Group.
        Component objComponent = (Component)_session.GetObject(componentTcmUri);
        // Get the list of objects, using this component. Filter the objects by page type. 
        XmlElement _xmlElement = objComponent.GetListUsingItems(filter);

But it is getting the old versions as well. Does anybody know how to eliminate older versions or any other better way to get that component link by passing tcm

 String _dependentPageUri = _xmlElement.FirstChild.Attributes.GetNamedItem("ID").Value;
            log.Info("_xmlElement****" + _xmlElement.InnerXml.ToString()+"*****");
            log.Info("_dependentPageUri" + _dependentPageUri);
            String currentPageUri = package.GetValue("Page.ID");
            if (currentPageUri != "")
            {
                if (currentPageUri == _dependentPageUri)
                {
                    if (_xmlElement.ChildNodes.Count > 1)
                    {
                        _dependentPageUri = _xmlElement.ChildNodes[1].Attributes.GetNamedItem("ID").Value;
                    }
                }
            }

All i need it PageURI using the TCM.

  • Can someone please help with how the " Old versions" filter can be applied using Interop? – TridionUser Oct 17 '18 at 12:30
5

First of all you need to change the type of your filter to UsingItemsFilter and then set IncludedVersions property of it to VersionCondition.OnlyLatestVersions

| improve this answer | |
  • I don't see that property for filter. i am using Tridion 2011.. – Vani Jul 25 '14 at 14:48
  • Indeed, I've updated my answer – Andrey Marchuk Jul 25 '14 at 15:00
  • what is the assembly for UsingItemsFilterData. i searched sdl.com www.sdltridionworld.com . please refer some website to get tridion resources. – Vani Jul 25 '14 at 15:00
  • It's in Tridion.ContentManager.dll – Andrey Marchuk Jul 25 '14 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.