Speed up widget development with Sitefinity MCP server. Learn more...

Retrieve related item with single related item limitation

Use this example when you want to retrieve a related item of an item, in case multiple items are not allowed. For example, you may have the limitation that a conference can have only one speaker. This means that to one conference item, you can relate only one speaker item.

In this case, if you use the GetRelatedItems method with the limitation to return a single item, you will get the error “Query execution found more than one element."

This is because every item has two versions – the Master and the Live.

In this case, you can retrieve the single item, using the RelatedDataPropertyDescriptor in the following way:

By default, it applies status filtering and returns either a collection of items or a single item (when you have limitation on the field).  It will return the related speaker with status corresponding to the item status – Master or Live.

NEW TO SITEFINITY?

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.

Get started with Integration Hub | Sitefinity Cloud

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting your Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.

Was this article helpful?