In v15/v16 IPublishedCache.GetAtRoot(string?) is obsolete and suggest using IDocumentNavigationQueryService instead.
It seems to return root keys, which I guess should be used to lookup instead.
It seems we can also use ContentAtRoot() from IPublishedContentQuery but unfortunately it didn’t support culture as the underlying GetAtRoot() : Allow `ContentAtRoot()` to accept culture by bjarnef · Pull Request #20129 · umbraco/Umbraco-CMS · GitHub
It seems there are a few different other options:
- Use
GetByIdfromIPublishedContentCacheas Andy’s example here: URL Segment Customisation with Umbraco 15.4
It seems it need to do multiple lookups though - not sure why anGetByIds()isn’t available? - Use
Content()fromIPublishedContentQuerywhich support multiple ids. - Use
ContentAtRoot()fromIPublishedContentQuerywhich isn’t obsolete, but doesn’t support requesting a specific culture as the oldGetAtRoot()
What are best practice to get root node(s) without knowing ids?