Copied to clipboard

Flag this post as spam?

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


  • Mikael Mørup 297 posts 326 karma points
    Sep 03, 2009 @ 09:10
    Mikael Mørup
    0

    How to get media name from API

    I have some media of type file, when they are uploaded they are given a name.

    How can i get that name with the API. (I don not mean the umbracoFile name)

    I have tried to do this:

     

    Dim m As New umbraco.cms.businesslogic.media.Media(nodeId)
    Dim name as string                      

    name = m.getProperty("nodeName").value.toString()

    I also tried
    name = m.getProperty("name").value.toString()

    and name = m.getProperty("text").value.toString() (because text is the name of the actual DB field)

    but none of the above properties seems to exist

    What am i doing wrong?

     

    thanks

    Mikael

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Sep 03, 2009 @ 09:22
    Sebastiaan Janssen
    0

    Try this:

    Media m = new umbraco.cms.businesslogic.media.Media(nodeId);
    name = m.text;

     

  • Mikael Mørup 297 posts 326 karma points
    Sep 03, 2009 @ 09:51
    Mikael Mørup
    0

    Yes that was exactly what i was looking for.

    Thanks

    Mikael

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Sep 03, 2009 @ 10:27
    Dirk De Grave
    0

    Mikael,

    Some extra info: Only custom defined properties can be addressed using the getProperty() method as you've specified. (syntax: x.getProperty("propertyAlias").Value)

    All 'generic' properties are defined as properties on the object ifself

     

    Cheers,

    /Dirk

  • Mikael Mørup 297 posts 326 karma points
    Sep 03, 2009 @ 11:29
    Mikael Mørup
    0

    Thanks Dirk, that is starting to make sense to me now :-)

     

    Mikael

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies