public SPUser InsertUser(UserObject user) { if (user == null) { return(null); } if (string.IsNullOrEmpty(user.UserName)) { return(null); } SPUser sharepointUser = null; try { using (SPWeb varWebSite = GetWebSite()) { SPUserCollection users = varWebSite.SiteUsers; users.Add(user.UserName, user.Email, user.Name, user.Notes); AssignPermission(user.Role, string.Empty, user.UserName); sharepointUser = varWebSite.AllUsers[user.UserName]; varWebSite.Update(); } } catch (Exception ex) { var log = new AppEventLog(AppException.ExceptionMessage(ex, "InsertUser", "ClsHelper")); log.WriteToLog(); } return(sharepointUser); }
public void Add(string loginName, string email, string name, string notes) { m_userCollection.Add(loginName, email, name, notes); }