Retrieving content

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

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 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 <FormCodeName>Item class. BizFormItemProvider supplies 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.

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.




// 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 CustomTableItemProviderand the generated <CustomTableCodeName>Item class. CustomTableItemProviderprovides 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.

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.




// 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 Class>Info, <Class>InfoProvider, and I<Class>InfoProvider classes.

See the Creating custom modules page for information on creating custom module classes and generating classes to work with them in your application.

Then use the corresponding IInfoProvider service and its Get method to retrieve the module class data (ObjectQuery API).

The following example shows how to get items from a sample Office module.




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