Hi Saar,
It seems like you got the query a bit wrong, it should look something like this:
UserQuery query = new UserQuery();
StringCriterion criteria = new StringCriterion();
criteria.Value = "VALUE";
// Optionally you can specify a wildcard type
criteria.WildCardType = WildCardType.Trailing;
query["ATTRIBUTE"] = criteria;
UserCollection myUser = QueryHandler.GetQueryResult<User, UserCollection>(query);
This query will assume that you have created an attribute of type System.String for the type EPiServer.Common.Security.IUser in the Edit mode. The attribute will have the name "ATTRIBUTE" - remember that it has to named exactly that.
Best regard,
Tom Stenius
Please help, I got this far but I can't seem to get anything back.
Idealy I would get the IUSER but the username would do.
UserQuery query = new UserQuery();
StringCriterion criteria = new StringCriterion();
criteria.Value = "16044646";
query["SomeValue"] = criteria;
UserCollection myCollection = QueryHandler.GetQueryResult(query);
IEnumerator myEnumerator = myCollection.GetEnumerator();
while (myEnumerator.MoveNext())
{
InfoLabel.Text += myEnumerator.Current.ToString();
}
figured it out, posting so maybe someone in the future will benefit
Get IUSER by attribute value:
I am stuck with this...
I am trying to retrieve an IUSER by an Attribute value.
I think I am in the right direction but I can't figure out what's wrong with the ICollection, also not sure this will retrieve the IUSER
UserQuery query = new UserQuery();
StringCriterion criteria = new StringCriterion();
criteria.Value = "VALUE";
query["ATTRIBUTE"] = criteria;
query.UserName = new StringCriterion();
ICollection<string> myCollection;
QueryHandler myUser = QueryHandler.GetQueryResult<