Copied to clipboard

Flag this post as spam?

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


  • Ferdy Hoefakker 214 posts 248 karma points
    Jul 22, 2010 @ 11:48
    Ferdy Hoefakker
    0

    Programmatically adding a propertytype to a membertype

    I have searched around, but I can't seem to find an answer to this. What I am trying to do, is to create a package that will install 3 ascx files with forms and a dll. No problem here. One of these however, is fired when the package is installing, which is what I want as it needs to prepare the Umbraco installation by adding a membertype, membergroup and a property for the membertype.

    When trying to create a property however, I need to add a DataTypeDefinition. I want to use an existing dataType, so I assume I can just hard code the GUID or ID with one of the get functions. But this seems sloppy. What would be the right way of doing this?

    Kind regards,

    Ferdy

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jul 22, 2010 @ 12:07
    Lee Kelleher
    0

    Hi Ferdy,

    Yes, to my knowledge, using the GUID is the best way to retrieve the DataTypeDefinition (via GetDataTypeDefinition).  The Id isn't reliable enough - as its specific to that Umbraco install, (unless you are using one of the default data-types that ships with Umbraco?)

    Given that this is for an installable package - hardcoding the GUID is the only way to do it.

    Cheers, Lee.

  • Ferdy Hoefakker 214 posts 248 karma points
    Jul 22, 2010 @ 12:24
    Ferdy Hoefakker
    0

    Thank you for the confirmation Lee. It is a default Umbraco datatype, so the ID will do just fine :)

    Kind regards,

    Ferdy

Please Sign in or register to post replies

Write your reply to:

Draft