Just a note on using ToPublishedContent() - this does at least one database call for each id you're trying to resolve...
Edit: There's a Pull Request dealing with this by allowing UmbracoHelper.TypedContent and friends to resolve UDI values to IPublishedContent - this would be the preferred way going forward.
The ToPublishedContent() is obsoleted in this patch as well so once this is out, it shouldn't be used at all.
Thanks for pointing us in right direction. Totally agree with you that UmbracoHelper.TypedContent to resolve UDI will be great, waiting for new version of Umbraco.
Content Picker Macro Parameter to IPublishedContent
Trying to figure out how to get from my 'NodeID' parameter on a Macro to a an IPublishedContent object.
Both of the following lines produce Null
While the last line produces "umb://document/b7e73eeed6ee48abb8d81076c14f25cb"
Hi Tim
Use this code:
And do not forget to use a reference to "Umbraco.Web.Extensions"
Just a note on using
ToPublishedContent()
- this does at least one database call for each id you're trying to resolve...Edit: There's a Pull Request dealing with this by allowing
UmbracoHelper.TypedContent
and friends to resolve UDI values to IPublishedContent - this would be the preferred way going forward.The
ToPublishedContent()
is obsoleted in this patch as well so once this is out, it shouldn't be used at all.Rob.
Hi Robert
Thanks for pointing us in right direction. Totally agree with you that
UmbracoHelper.TypedContent
to resolve UDI will be great, waiting for new version of Umbraco.Alex
Thank you! I was facing the same issue and trying to resolve it for quite some time. This solution worked for me.
However, I do see that IPublishedContent is the preferred way forward. How can we rewrite the solution to implement that? I'm on Umbraco 7.6.3.
Thanks once again!
Thanks Alex!
I posted in the other forum post I found with a similar issue.
This line was returning Null for me, I had to republish the entire site after an upgrade from 7.5.13 to 7.6.1, then it returned as intended.
Hi Tim
Glad to help!! Have a great evening!
Alex
is working on a reply...