sandeep.narang

FindElementsByTemplate is not working with searchRoot option

Discussion created by sandeep.narang on Sep 13, 2011
Latest reply on Sep 18, 2011 by pcombellick

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,

 

 

Outcomes