Get User by unique custom attribute - v12

Erik Kozlowski asked on September 12, 2022 19:40

UserinfoProvider.GetuserInfo only accepts ID and username. I'm just curious if theres a way to get user info based on a unique custom attribute.

Quite new to Kentico, so any insight would be appreciated. Thank you!

Correct Answer

Dmitry Bastron answered on September 13, 2022 09:45

Hi Erik,

You can check a few query examples here in the documentation.

For your particular case it would be:

var user = UserInfoProvider.GetUsers().WhereEquals("YourCustomAttr", "Value").TopN(1).FirstOrDefault();
0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.