IMember _newMember = ApplicationContext.Current.Services.MemberService.CreateMember("username", "user@email.com", "Full Name", "Member"); Services.MemberService.Save(_newMember); Services.MemberService.AssignRole(_newMember.Id, "Group Name");
The new member has to be saved first before you can assign it to role/group.