public void Remove(object user) { if (user == Null.Value || user == Undefined.Value || user == null) { throw new ArgumentNullException("user", @"A user to remove must be specified either by id or login name."); } if (TypeUtilities.IsNumeric(user)) { m_userCollection.Remove(TypeConverter.ToInteger(user)); } else { m_userCollection.Remove(TypeConverter.ToString(user)); } }
public void DeleteUser(string username) { if (string.IsNullOrEmpty(username)) { return; } try { SPUser user = GetUserObject(username); if (user == null) { return; } using (SPWeb website = GetWebSite()) { SPUserCollection varUsers = website.SiteUsers; varUsers.Remove(username); website.Update(); } } catch (Exception ex) { var log = new AppEventLog(AppException.ExceptionMessage(ex, "DeleteUser", "ClsHelper")); log.WriteToLog(); } }