Copied to clipboard

Flag this post as spam?

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

  • Mike Rowe 9 posts 109 karma points
    Mar 27, 2016 @ 02:31
    Mike Rowe

    How do we get the MemberType ID?

    I'm new. I am doing a lot of testing for a project I've taken on that requires importing csv list of members. This testing requires removing the members from the database. The Our.Umbraco documentation for removing all members looked easst to implement using:

    var memser = Services.MemberService;

    The Umbraco documentation indicates:

    Services.MemberService.DeleteMembersOfType(int id)

    "Deletes all members of a given type"

    Nowhere can I find the function that returns the integer value of the "Members" MemberType.

    As a workaround, using the Visual Studio the SQL Server Compact/SQLite Toolbox, I was able to find the value "1044" in the cmsMemberType table.

    What code will return that integer value of a named MemberType?

  • Sebastiaan Janssen 4880 posts 14554 karma points MVP admin hq
    Mar 27, 2016 @ 09:58
    Sebastiaan Janssen

    Using the MemberTypeService - :

    var memberType = ApplicationContext.Current.Services.MemberTypeService.Get("myMemberTypeAlias");
    var memberTypeId = memberType.Id;
  • Mike Rowe 9 posts 109 karma points
    Mar 28, 2016 @ 00:19
    Mike Rowe

    Thank you for your prompt answer. I suspect that other newbees would benefit if your answer was part of the documentation. I will humbly suggest adding your answer as an example to the documentation. If that was part of the current documentation, inexperienced persons like me would not be posting a question like this.

    Thanks again.

Please Sign in or register to post replies

Write your reply to: