I achived to check the authrization of user follwoing way.
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;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment