2025/11/18 10:09 PM
I have been trying to retrieve some content and the url of web pages in XbyK for multiple content types using RetrieveContentOfContentTypes.
It threw error if I use "IWebPageFieldsSource" as Model of the final retrieved results.
var contentTypes = new[] { NewsArticle.CONTENT_TYPE_NAME, ContentPage.CONTENT_TYPE_NAME };
var parameters = new RetrieveContentOfContentTypesParameters
{
LinkedItemsMaxLevel = 1,
IncludeUrlPath = true,
};
var items = await contentRetriever.RetrieveContentOfContentTypes<IWebPageFieldsSource>(
contentTypes,
parameters,
query => query.Where(where =>
where.WhereIn(nameof(IContentQueryDataContainer.ContentItemGUID), ids)
),
cacheService.RetrievalCacheSettings(
$"{nameof(CoreContentModel)}|multi:{string.Join(',', contentTypes)}|ids:{string.Join(',', ids)}"
),
cancellationToken);
Furthermore, even if I use "IContentItemFieldsSource" as Model of the final retrieved results, it throws error. However, if I map to custom model it works fine, but I am not able to get the url of the page. Is there some ways to get the url of the page using RetrieveContentOfContentTypes.
Tags:
Community members
Kentico
Content querying
Object querying