Hello everyone,
I'm trying to get all the published content by culture/language in umbraco 8 but still I'm not getting it the right way.
I am using this code:
var allPublishedContent = new List<IPublishedContent>();
foreach (var publishedContentRoot in Umbraco.ContentAtRoot().Where(e => e.Cultures.ContainsKey("en-us")))
{
allPublishedContent.AddRange(publishedContentRoot.DescendantsOrSelf());
}
I've tried you code in my project and, at least in my case, Cultures is a Two-Letter Code.
Have you tried this?
foreach (var publishedContentRoot in Umbraco.ContentAtRoot().Where(e => e.Cultures.ContainsKey("en")))
If it still not working try to debug your code and set a breakpoint to check what are you culture keys.
In case you don't know how to debug your code in Visual Studio, run your project as usual and in the menu option Debug -> Attach to process look for the IISexpress process.
Add this line and set a breakpoint on it:
var contents = Umbraco.ContentAtRoot();
And see what values you have on the Cultures property.
Get All published content by culture - Umbraco 8
Hello everyone, I'm trying to get all the published content by culture/language in umbraco 8 but still I'm not getting it the right way.
I am using this code:
Thanks and have a great day everyone!
Hi,
I've tried you code in my project and, at least in my case, Cultures is a Two-Letter Code.
Have you tried this?
If it still not working try to debug your code and set a breakpoint to check what are you culture keys.
In case you don't know how to debug your code in Visual Studio, run your project as usual and in the menu option Debug -> Attach to process look for the IISexpress process.
Add this line and set a breakpoint on it:
And see what values you have on the Cultures property.
Hope this helps.
Hello Daniel,
Appreciate your reply. Already resolved my problem by doing this
Reference Link here: https://our.umbraco.com/Documentation/Reference/Language-Variation/
is working on a reply...