Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jan 10, 2012 @ 14:33
    Ismail Mayat
    0

    Get list of all datatypes of type rich text edit

    Guys,

    Using umbraco 4.7 how do can I using the api get list of all datatypes in my install of type rich text edit?

    Regards

    Ismail

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 10, 2012 @ 14:42
    Tom Fulton
    4

    This should do the trick:

    using umbraco.cms.businesslogic.datatype;

    DataTypeDefinition.GetAll().Where(d => d.DataType != null && d.DataType.Id == new Guid("5e9b75ae-face-41c8-b47e-5f4b0fd82f83"))

    -Tom

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 10, 2012 @ 14:42
    Dirk De Grave
    1

    i'm not sure about the api, but a sql statement will surely get you there... just check for controlId

    5E9B75AE-FACE-41c8-B47E-5F4B0FD82F83

    in table cmsDataType

     

    HTH,

    Cheers,

    /Dirk

     

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Jan 10, 2012 @ 14:47
    Ismail Mayat
    0

    Dirk,

    Just realised im asking the wrong question what i acutally need is for all my doc types get field aliases of fields that are based on rich text edit and definately reckon sql would be best way though not sure what tables to query exactly.

    Any ideas?

     

    Ta

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 10, 2012 @ 14:52
    Dirk De Grave
    1

    sure it can be done, cmsPropertyType should be your friend..., holds a datatypeId which should be -87 if you use the oob rich text editor, otherwise you need to perform an join on the cmsDatatype (and controId should be as stated above)

     

    Makes sense?

    HTH,

    Dirk

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 10, 2012 @ 14:53
    Tom Fulton
    3

    SQL might be best, but if you still want to use the API, I think something like this will work:

                foreach (var dtd in DataTypeDefinition.GetAll().Where(d => d.DataType != null && d.DataType.Id == new Guid("5e9b75ae-face-41c8-b47e-5f4b0fd82f83")))
                {
                    foreach (var pt in PropertyType.GetByDataTypeDefinition(dtd.Id))
                    {
                        ContentType ct = new ContentType(pt.ContentTypeId);
                        // Found RTE with alias (" + pt.Alias + ") on DocType:" + ct.Text
                    }
                }
  • Matt Bliss 176 posts 234 karma points c-trib
    Jan 10, 2012 @ 15:01
    Matt Bliss
    0

    If you want to get all datatypes based on the Rich text edit then do a lookup on 'cmsDataType' in the 'contolId' column for '5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83' and cross reference these results using the 'nodeId' column as Dirk mentions above in the cmsPropertyType table.

    Hope that helps,

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft