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
In Umbraco 6, using new APIs, How to get NiceUrl from IContent object for content node?
Thanks & Regards
Similar unanswered post http://our.umbraco.org/forum/developers/api-questions/38261-Umbraco-6-New-API-How-do-I-get-a-URL ;
I'll follow this too - this is a real blocker for me adopting the new API
Hi Pinal & Keith
Having same issue, but have something that works, if it could be undertood why it works (it's not pretty), maybe we can head to a solution.
Using V6 in Mvc.
var pages = CurrentPage.AncestorOrSelf("topNode").Descendants().Where("DocumentTypeAlias == \"ChildNode\"");
You could try to use the UmbracoHelper. If you have the helper availabile you could do this:
Thanks for reply - have to admit this has confused me - something so simple
from above @pages.Umbraco.Url() gives the following error
Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Umbraco'
also intellisense saying NiceUrl is deprecated, use Url.
Unless I am not using the helper correctly, or not calling the correct using statements?
All seems to work up until the where statement, then without the loop there are no definitions as you would expect.
Any help would be much appreiated - ok it runs for now, but would prefer a solution to the workaround.
You can find more info about the Umbraco Helper here:
Many thanks - yes that works, but only for one NodeId - I need to get to the documentType as this is for a button to a booking form, so for each of the "sections" the nodeId is different, there is nothing in the helper that I can see that will give me this.
Surely there must be a simple way to achieve this?
The helper has a TypedContent method in which you can pass multiple id's which will return the nodes which contain the url. More info here: http://our.umbraco.org/forum/developers/api-questions/37894-new-Dynamic(id)-and-new-Node(id)-equiv-in-v6
That doesn't really help, yes I can add multiple nodeIds, but, is it not much simpler to call the documentType instead of having to add the new node everytime a new "section" is added?
I think I have been through all the possiblities, but put very simply I want to go to the parent node, come back down, find the documentType (which is unique) and get the Url to add to a button to take user to that page. I have never had an issue doing this in previous versions, just can't find a way to achieve it in V6.
Or maybe I am missing something really obvious? It does happen.
So many responses but still no satisfactory answer. How to get NiceUrl from IContent object for content node?
The IContent object does not provide a Url. Are you trying to query Umbraco for IContent to use that on the frontend? IContent is NOT cached content and goes straight to the database it is not advisable to use it on the frontend. I don't know what exactly you're trying to do but something like this will work:
See the documentation at: http://our.umbraco.org/documentation/Reference/Mvc/querying
I'm actually running into this as well. I'm importing a bunch of content over from Sitecore & need the new url during import to set up the approriate redirects. I know that url generation is based on the xml cache structure, but it seems like there should be some way to get at it from deeper inside.
Is IContent not an interface?
Gary i am confused as to what the problem is? :). Charlie.
apologies for very late reply, am posting this from my phone a my computer is dead, and a new one may take.some time.to arrive.
this all happened in 6.0, think it was the RC, it was to do with dynamic content not returning as it should, or the content not saving correctly, or.maybe a combination of the two.
Should.be marked as solved, or gone.away, but will do it when i can find it via this device while i juggle with the magnifying glass to try to see anything.
Not the easiest ofthings to achieve, the forum on a mobile, but needs must and all that.
cheers for your input
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted