Below code shows how we can get the SharePoint permission levels and assign it to a ASP.NET DropDownList (drpPermissions)
drpPermissions.AppendDataBoundItems = true;
SPWeb currentSite = SPContext.Current.Site.RootWeb;
SPRoleDefinitionCollection permissionColl = currentSite.RoleDefinitions;
foreach (SPRoleDefinition permission in permissionColl)
{
drpPermissions.Items.Add(permission.Name.ToString());
drpPermissions.DataBind();
}
No comments:
Post a Comment