mass delete users

lawrence whittemore asked on March 28, 2014 10:03

Is there a way to mass delete users? I created a site based of a previous installation and database and it has over 700 users that I want to remove.

Recent Answers

Filip Ligač answered on March 28, 2014 11:06

Hi Lawrence,

You would need to use Kentico API to achieve it since there is no way to do it through user interface.

The code could look similar to this:

private bool GetAndBulkDeleteUsers()
    // Prepare the parameters
    string where = "UserEnabled = 1";

    // Get the data
    DataSet users = UserInfoProvider.GetUsers(where, null);
    if (!DataHelper.DataSourceIsEmpty(users))
        // Loop through the individual items
        foreach (DataRow userDr in users.Tables[0].Rows)
            // Create object from DataRow
            UserInfo deleteUser = new UserInfo(userDr);

            // Delete the user
        return true;
    return false;
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.