Strange results from GetByContentType
# help-with-umbraco
i
I've been doing some testing this morning with the method GetByContentType and I'm getting some strange results: { "gaitSessions": 44, "gaitSessionsOther": 44, "devices": 0, "devicesOther": 5, "deviceFamilies": 0, "deviceFamiliesOther": 9 } The first result for each document type is using GetByContentType, the second "other" value is from GetByXPath Some document types are returning no results, when clearly they do exist (as XPath works) The only difference between the document types are: GaitSessions are single language DeviceFamily is setup for multiple languages Devices are a child of DeviceFamily but setup for single language Example code: using var ctx = _umbracoContextFactory.EnsureUmbracoContext(); var content = ctx.UmbracoContext.Content; var gaitSessionContentType = GaitSession.GetModelContentType(_publishedSnapshotAccessor); var gaitSessions = content?.GetByContentType(gaitSessionContentType); var gaitSessionsOther = content?.GetByXPath($"//{GaitSession.ModelTypeAlias}");
p
I've had some issues with GetByContentType as well, though I totally forgot to make an issue for it on Github
It just not returning any items even though they do exist
i
Looks like someone else has beat us to it !! https://github.com/umbraco/Umbraco-CMS/issues/14538