---
title: Retrieving content in MVC applications
related:
  - https://docs.kentico.com/k12sp/developing-websites/generating-classes-for-kentico-objects.md
  - https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications/displaying-page-attachments.md
  - https://docs.kentico.com/k12sp/custom-development/working-with-pages-in-the-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).

The following section describes how to retrieve Kentico data in MVC applications. You can work with the following system objects:

- [Pages](https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications/displaying-page-content.md)
- [Page attachments](https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications/displaying-page-attachments.md)
- [Form records](#retrieving-form-data)
- [Custom table items](#retrieving-custom-table-data)
- [Custom module classes](#retrieving-custom-module-data)
- [Media library files](https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications/displaying-content-from-media-libraries.md)

## Retrieving form, custom table, and custom module data

Forms, custom tables, and custom modules all use the same process for retrieving stored entries from their corresponding database tables. To retrieve content from these objects, [include their generated classes](https://docs.kentico.com/k12sp/developing-websites/generating-classes-for-kentico-objects.md) into your solution and use their API in the code in your application.

### Retrieving form data

When retrieving forms data, use _BizFormItemProvider_ and the generated _Item_ class. _BizFormItemProvider_ supplies two methods to facilitate form data retrieval:

- **GetItem** –returns a record of the specified type and ID.
- **GetItems** – returns all records of the specified type using the [ObjectQuery API](https://docs.kentico.com/k12sp/custom-development/retrieving-database-data-using-objectquery-api.md).

The following example demonstrates how to retrieve individual submissions from a '_Contact Us_' form. The code uses the _ContactUsItem_ class generated via the form's **Code** tab to work with individual submitted entries.

```csharp

// 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);

```

### Retrieving custom table data

When retrieving custom table data, use _CustomTableItemProvide&#x72;_&#x61;nd the generated _Item_ class. _CustomTableItemProvide&#x72;_&#x70;rovides two methods to facilitate form data retrieval:

- **GetItem** –returns a record of the specified type and ID.
- **GetItems** – returns all records of the specified type using the [ObjectQuery API](https://docs.kentico.com/k12sp/custom-development/retrieving-database-data-using-objectquery-api.md).

The following example demonstrates how to retrieve individual records from a custom table called '_Sample table_'. The code uses the _SampleTableItem_ class generated via the custom table's **Code** tab to work with individual submitted entries.

```csharp

// Gets all custom table items
IEnumerable<SampleTableItem> items = CustomTableItemProvider.GetItems<SampleTableItem>();

// Gets a single custom table item for a given custom table item ID
SampleTableItem item = CustomTableItemProvider.GetItem<SampleTableItem>(1);

```

### Retrieving custom module data

To retrieve data from custom module classes, generate their corresponding _InfoProvider_ and _Info_ object classes.

> **Tip:** See the [Creating custom modules](https://docs.kentico.com/k12sp/custom-development/creating-custom-modules.md) page for information on creating custom module classes and generating classes to work with them in your application.

The following example shows how to work with items from a sample _Office_ module.

```csharp

// Gets all custom module class items
IEnumerable<OfficeInfo> items = OfficeInfoProvider.GetOffices();

// Gets a single custom module class item for a given class ID
OfficeInfo item = OfficeInfoProvider.GetOfficeInfo(1);

```
