"Cannot render a macro when there is no current PublishedContentRequest" API problem
Umb V7.15.3
I have a controller extending UmbracoApiController. It's purpose is to import a page from one site to another and it works absolutely fine except in one particular scenario, if there's a Macro (like an embedded form) in an RTE.
The following code works fine if the RTE doesn't contain a macro. If it does, then it throws the exception. "Cannot render a macro when there is no current PublishedContentRequest." My code is:-
Following a nudge from sjb101 on the Slack channel the answer was to refactor "theArticle" by pulling it using the Content Service so it was an IContent rather than an IPublishedContent. So the code is now:-
"Cannot render a macro when there is no current PublishedContentRequest" API problem
Umb V7.15.3
I have a controller extending UmbracoApiController. It's purpose is to import a page from one site to another and it works absolutely fine except in one particular scenario, if there's a Macro (like an embedded form) in an RTE.
The following code works fine if the RTE doesn't contain a macro. If it does, then it throws the exception. "Cannot render a macro when there is no current PublishedContentRequest." My code is:-
returnArticle is my own Model. theArticle is an IPublishedContent.
This is deep in a controller, far far away from rendering anything. It should just be assigning the RTE's content into the string variable.
There are quite a few questions in the forum about this but none have a solution. I'd really appreciate a steer even if not a solution.
Thanks,
// Craig }
Following a nudge from sjb101 on the Slack channel the answer was to refactor "theArticle" by pulling it using the Content Service so it was an IContent rather than an IPublishedContent. So the code is now:-
And works nicely thanks very much :)
//Craig
is working on a reply...
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.