
public static bool IsUserExistsInGroup(string aGroupName, SPWeb aWeb, string aUserName)
{
SPGroup userGroup;
SPUser user;
bool userExists = false;
try
{
userGroup = aWeb.Site.RootWeb.SiteGroups[aGroupName];
try
{
user = userGroup.Users[aUserName];
if (user != null)
{
userExists = true;
}
}
catch
{
}
}
catch (Exception ex)
{
throw ex;
}
return userExists;
}
No comments:
Post a Comment