Frontend development

Projection of items

Overview

To control the fields returned from the service, you use the Fields property for both getting a single item and a collection of items. These are related items, related media, and non-related fields. You pass the fields in a comma-separated in the following way:

C#
await restClient.GetItems<NewsDto>(new GetAllArgs()
{
    Fields = new[] { "Id", "Title" },
});

Retrieve all fields

To retrieve all of the fields - related and non-related, you can pass an asterisk (*) as value in the following way:

C#
await restClient.GetItems<NewsDto>(new GetAllArgs()
{
    Fields = new[] { "*" },
});

Expand levels

To expand more than one level of relations, you can use the following syntax:

C#
await restClient.GetItems<NewsDto>(new GetAllArgs()
{
    Fields = new[] { "Id", "Title", "Thumbnail(Title, ThumbnailUrl, Parent(Title, Description), Tags)" },
});

In the above example Thumbnail is a related image and Parent is the library of the image.

NOTE: By default, the expansion of levels is limited to two. To expand more than two levels, you must change the configuration for the web service in Sitefinity CMS » Administration » Settings» Advanced» WebServices.

Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.