More in this section

Forums / Developing with Sitefinity / SF v5.1 Import users from CSV

SF v5.1 Import users from CSV

3 posts, 0 answered
  1. Dave
    Dave avatar
    2 posts
    Registered:
    21 Aug 2012
    21 Aug 2012
    Link to this post
    What is the proper method for mass importing users from CSV on SiteFinity v 5.1?  I'd like to import via CSV and also force the user to set a new password after their initial login.
  2. Bill
    Bill avatar
    53 posts
    Registered:
    28 Jun 2006
    31 Aug 2012
    Link to this post
    This would be extremely useful.  It would also be nice to import any generic data to the database with csv when creating a custom module.
  3. Matt
    Matt avatar
    35 posts
    Registered:
    01 Nov 2010
    07 Sep 2012
    Link to this post
    I am also interested in a feature that will allow me to import users or customers from a flat file(.csv).  Maybe someone with skills and free time can that take the control that is used for importing subscribers for emails campaigns and make it work for importing users?  I'm not sure if you can access the Import Subscribers code and reuse it with the help of Sitefinity Thunder.  

    Here's the basics and link to documentation
    var userManager = UserManager.GetManager("Default");
    System.Web.Security.MembershipCreateStatus status;
    userManager.Provider.SuppressSecurityChecks = true;
    var user = userManager.CreateUser("user1@test.com", "user1234@", "user1@test.com", "Question", "Answer", true, null, out status);
     
    user.FirstName = "FirstName";
    user.LastName = "LastName";
    userManager.SaveChanges();
      
    RoleManager roleManager = RoleManager.GetManager("AppRoles");
    roleManager.Provider.SuppressSecurityChecks = true;
    var role = roleManager.GetRole("Administrators");
    roleManager.AddUserToRole(user, role);
    roleManager.SaveChanges();
3 posts, 0 answered