Hello All Experts,
I want to get the Role Name using c# code based on userid provided .
how to get it.
can anyone provide me with a sample code.
*This post is locked for comments
Hi,
Please refer the links below. It gives C# code for getting security role of the user.
worldofdynamics.blogspot.in/.../retrieve-user-security-roles-code.html
mscrmtechie.blogspot.in/.../checkget-user-security-role-in-crm.html
Hope this helps.
Hi,
Using early bound classes you can achieve this using this method.
public void GetSecurityRolesOfTheUser(XrmServiceContext serviceContext, Guid userid) { var systemUserRoles = (from ur in serviceContext.SystemUserRolesSet join r in serviceContext.RoleSet on ur.RoleId equals r.RoleId where ur.SystemUserId == userid select r.Name).ToList(); }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156