Sitecore query/fast query for user

后端 未结 1 1279
抹茶落季
抹茶落季 2021-01-26 19:29

Is there a way to use fast query or query to get a user by email or a custom field? I tried this but it didn\'t work in the Query Tool

/sitecore/user//*[@@templateid=\'

相关标签:
1条回答
  • 2021-01-26 19:58

    You cannot query (via Sitecore Query or Fast Query) users in the User Manager because they are not items, they're actually built on ASP.NET Membership in the Core database. Instead, you can look into something like Membership.GetAllUsers() (MSDN doc) and filter the results with LINQ based on what you're looking for.

    I've done something similar in Sitecore where I called Sitecore.Security.Accounts.UserManager.GetUsers() and filtered the resulting User objects by their name property. You could do something similar like this:

    var matches = UserManager.GetUsers().Where(usr => usr.Profile.Email.Equals(emailToMatch));
    
    0 讨论(0)
提交回复
热议问题