9 Replies Latest reply on Sep 18, 2011 4:55 PM by pcombellick

    FindElementsByTemplate is not working with searchRoot option

    sandeep.narang

      Hi Team,

       

      I am using the below code to get the element information...

       
      AFObject searchRoot = null;
      AFNamedCollectionList objAFElementCollection = new AFNamedCollectionList();
      if (!string.IsNullOrEmpty(elementPath))
          searchRoot = AFObject.FindObject(elementPath);
      objAFElementCollection = AFElement.FindElementsByTemplate(this.Database, searchRoot, this.Database.ElementTemplates[elementTemplateName], true, AFSortField.Name, this.Order, maxCount);
      

       

       

      This code is not working, it should return the collection of 4 elements.

       

      Note : This code is working fine if searchRoot is null. As per our requirement, we need to find the element information based on template which is laying below the root.

       

       

       

      Please assist us on this.

       

      Thanks,