Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Nick 37 posts 130 karma points
    Jun 26, 2013 @ 09:48

    How to create members and assign to roles using API in Umbraco 6.x


    I need to create a web service that can dynamically create members and assign them to member roles.

    What is the best way to do this using the API?

    There is a section on the API cheatsheet ( )but it says that it is out of date and should be updated:




  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 26, 2013 @ 11:01
    David Brendel

    Most of the member api is marked as outdated but can be used. So just try to use the functions you need and see if they work.

    Here's a sample on how you create a new user and set a membergroup to him:

    //Member Type

                MemberType umbJobMemberType = MemberType.GetByAlias("TMMember");

                //Umbraco Admin User (The Umbraco back office username who will create the member via the API)

                User umbUser = new User("dbrendel");

                //Model valid let's create the member



                    Member createMember = Member.MakeNew(model.Name, model.EmailAddress, model.EmailAddress, umbJobMemberType, umbUser);

                    //Set password on the newly created member

                    createMember.Password = model.Password;

                    //Set the verified email to false

                    createMember.getProperty("hasVerifiedEmail").Value = false;

    //Set the profile URL to be the member ID, so they have a unqie profile ID, until they go to set it

                    createMember.getProperty("profileURL").Value = createMember.Id;


                    //Save the changes



                catch (Exception ex)


                    //EG: Duplicate email address - already exists



    The example comes from an Mvc controller, so the model.Property is just an object with the infos provided by the user.

    To set up the webservice in Umbraco i would recommend using UmbracoApiController if you are on Umbraco 6.1.x. But i think there should be more than one way to get somethink like a webservice up and running.

  • Nick 37 posts 130 karma points
    Jun 26, 2013 @ 12:23

    Hi David,

    thanks for the reply. I am not too familiar with MVC and am using web forms.

    Does v6 use the ASP.NET membership provider? Is there any example code for creating members and assigning them to Umbraco MemberGroup's  using this?


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jun 26, 2013 @ 12:32
    Jeroen Breuer


    The member api will get a new version, but the old api is still the best thing for now. The obsolete attributes have even been removed again in the latest version of Umbraco:

    New member api:

    So this documentation is still good:


  • Nick 37 posts 130 karma points
    Jun 26, 2013 @ 12:34

    Thanks Jeroen.

Please Sign in or register to post replies

Write your reply to: