The trick is
SPUser user = web.EnsureUser(peCheckUser.Accounts[0].ToString());
SPGroupCollection collGroups = user.Groups;
if (collGroups.Count > 0)
{
foreach (SPGroup oGroup in collGroups)
{
oGroup.RemoveUser(user);
}
strError += "User Removed Successfully...!";
}
thanks to author @ http://sharepoint2010tutorialnew.blogspot.com/2011/12/deleting-user-within-sharepoint-group.html
SPUser user = web.EnsureUser(peCheckUser.Accounts[0].ToString());
SPGroupCollection collGroups = user.Groups;
if (collGroups.Count > 0)
{
foreach (SPGroup oGroup in collGroups)
{
oGroup.RemoveUser(user);
}
strError += "User Removed Successfully...!";
}
thanks to author @ http://sharepoint2010tutorialnew.blogspot.com/2011/12/deleting-user-within-sharepoint-group.html
No comments:
Post a Comment