The most common ways to query a user profiles are:
In this examples, you make a query for the specified user and pass it to the GetUserPofile<T> method of the manager.
Querying a profile by username
The code for querying a user profile by username is similar to the one for querying user profiles by user’s ID. The only difference is that you query the user by calling the GetUser(string username) overload.
Alternatively, you can make a query for all the profiles and filter them by a desired criteria. You must call the desired overload of the GetUserProfiles method. Note that it returns all available profiles no matter their type. If you have other profile implementations, you must filter the collection by the type of the profile.
Querying all profiles by role
In the code above, you get an instance of the role manager class by passing the provider name for the predefined roles that are built in Sitefinity CMS. Using the role manager you get all the users in a specific role. Next, you get an instance of the user profile manager class and get all the user profiles. Finally, you match the user ID's of the user profiles with the user ID's of the users in the specified role and return the result.
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
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.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important