To display Roles for current user see the example below -
SPSite currentSite = SPContext.Current.Site;
SPWeb currentWeb = currentSite.OpenWeb();
SPRoleDefinitionBindingCollection roles = currentWeb.AllRolesForCurrentUser;
foreach(SPRole role in roles)
{
Response.Write(role.Name);
}
No comments:
Post a Comment