Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 2Check out the latest updates and new features of Dynamics 365 released from October 2022 through March 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
How can I retrieve a user by username?
This is how I do it using Id:
public virtual MemberAccount Get(Guid id)
var entity = OrganizationService.Retrieve("Member", id, GetColumnSet());
var returnEntity = (MemberAccount)Activator.CreateInstance(typeof(MemberAccount), entity);
This how I do it with a query (GetAll):
public virtual IEnumerable<MemberAccount> GetAll()
QueryExpression query = new QueryExpression()
EntityName = "Member",
ColumnSet = GetColumnSet(),
var result = OrganizationService.RetrieveMultiple(query);
var returnList = new List<MemberAccount>();
foreach (var entity in result.Entities)
The easiest way is to add a ConditionExpression to your QueryExpression to filter by name:
query.Criteria.AddCondition("fullname", ConditionOperator.Equal, name);
Where name contains the name you are searching for. Or you could use the BeginsWith or Contains ConditionOperator
Business Applications communities