---
title: Content retrieval
related:
  - https://docs.kentico.com/documentation/developers-and-admins/api/generate-code-files-for-system-objects.md
  - https://docs.kentico.com/documentation/developers-and-admins/api/content-item-api/content-item-query-api.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

This section describes how to retrieve data from Xperience. You can work with the following system objects:

- [Pages](https://docs.kentico.com/documentation/developers-and-admins/development/content-retrieval/retrieve-page-content.md)
- [Content items](https://docs.kentico.com/documentation/developers-and-admins/development/content-retrieval/retrieve-content-items.md)
- [Form records](#retrieve-form-data)
- [Media library files](https://docs.kentico.com/documentation/developers-and-admins/development/content-retrieval/retrieve-content-from-media-libraries.md)
- [General objects managed by the system](#retrieve-general-object-data)
- [Retrieve content from headless channels using GraphQL](https://docs.kentico.com/documentation/developers-and-admins/development/content-retrieval/retrieve-headless-content.md)

## Retrieve form data

When retrieving forms data, use `BizFormItemProvider` and [generated](https://docs.kentico.com/documentation/developers-and-admins/api/generate-code-files-for-system-objects.md) _Item_ classes. `BizFormItemProvider` exposes two methods to facilitate form data retrieval:

- `GetItem<TType>`–returns a record of the specified type and ID.
- `GetItems<TType>` – returns all records of the specified type using the [ObjectQuery API](https://docs.kentico.com/documentation/developers-and-admins/api/objectquery-api.md).

The following example demonstrates how to retrieve individual submissions from a '_Contact Us_' form. The code uses a generated form data class (`ContactUsItem`) to work with individual submitted entries.

```csharp
using System.Collections.Generic;

using CMS.OnlineForms;

// ...

// Gets all form items of the given type
IEnumerable<ContactUsItem> items = BizFormItemProvider.GetItems<ContactUsItem>();

// Gets a single form item with the given type and ID
ContactUsItem item = BizFormItemProvider.GetItem<ContactUsItem>(1);

// Programatically assigns and saves a value for the form record's 'CustomField' input
object customFieldValue = "CustomValue";
item.SetValue(nameof(item.Fields.CustomField), customFieldValue);
item.SubmitChanges(false);
```

## Retrieve general object data

To retrieve general objects managed by the system, use the corresponding _Info_ classes (e.g., `UserInfo`) and the `I<Class>InfoProvider` interface to retrieve the data. The query generated by the `Get` method of the interface can be parameterized using ObjectQuery syntax, see [ObjectQuery API](https://docs.kentico.com/documentation/developers-and-admins/api/objectquery-api.md) and [Database table API](https://docs.kentico.com/documentation/developers-and-admins/api/database-table-api.md) for more information.

The following example shows how to get user objects.

```csharp
using System.Collections.Generic;

using CMS.Membership;

public class CustomComponent(IUserInfoProvider userInfoProvider)
{

    // ...

    // Gets all users and materializes the result
    IEnumerable<UserInfo> users = userInfoProvider.Get().GetEnumerableTypedResult();
}
```
