Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 triedname = 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
Try this:
Media m = new umbraco.cms.businesslogic.media.Media(nodeId);
name = m.text;
Yes that was exactly what i was looking for.
Thanks
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
Thanks Dirk, that is starting to make sense to me now :-)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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
Try this:
Yes that was exactly what i was looking for.
Thanks
Mikael
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
Thanks Dirk, that is starting to make sense to me now :-)
Mikael
is working on a reply...