Search

Fing system user by name in MSCRM4

This is a code sample to find and return a system user by running a query over the name:
// find system user by name
private systemuser GetUser(string name)
{
QueryByAttribute query = new QueryByAttribute();
ColumnSet column = new ColumnSet();
column.EntityName = EntityName.systemuser.ToString();
//column.Attributes = new String[] { "name", "systemuserid" };
query.EntityName = EntityName.systemuser.ToString();

systemuser sysUser = new systemuser();
return sysUser; //returns system user
}