Import users from CSV?? - General Discussions - General Discussions - Progress Community
 General Discussions

Import users from CSV??

  • Import users from CSV??
  • Has anyone had any luck creating something custom that does this?
  • Hi Eli,

    There is no way to directly import users from an .csv. You will need to add them by creating a custom membership provider and use the users from the other system:Create a custom membership provider or use the API to create the users in  Sitefinity:Creating users and Creating user profiles.

    Ivan D. Dimitrov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  • How to read data from CSV files ?
  • Hi Roshith,

    Very rough example how to read from CSV file and then create users in Sitefinity:

    // CSV format username;password;firstName;lastName;mail;secretQuestion;secretAnswer;isApproved
    public static void YourFunction()
        var users = File.ReadAllLines("users.csv");
        foreach (var user in users)
            var data = user.Split(";");
            CreateUser(data[0], data[1], data[2], data[3], data[4], data[5], dataDevil, bool.Parse(data[7]));
    public static MembershipCreateStatus CreateUser(string username, string password, string firstName, string lastName, string mail, string secretQuestion, string secretAnswer, bool isApproved)
        UserManager userManager = UserManager.GetManager();
        UserProfileManager profileManager = UserProfileManager.GetManager();
        System.Web.Security.MembershipCreateStatus status;
        User user = userManager.CreateUser(username, password, mail, secretQuestion, secretAnswer, isApproved, null, out status);
        if (status == MembershipCreateStatus.Success)
            SitefinityProfile sfProfile = profileManager.CreateProfile(user, Guid.NewGuid(), typeof(SitefinityProfile)) as SitefinityProfile;
            if (sfProfile != null)
                sfProfile.FirstName = firstName;
                sfProfile.LastName = lastName;
        return status;