I am currently working on a console application running Umbraco, based on the code I found here. I can access Umbraco ContentService through the Current.Services.ContentService class. However, I do not know how to obtain the content Urls in this setup. UmbracoContext is null inside the console application. I tried with IUmbracoContextFactory.EnsureUmbracoContext() but a nullReferenceException is thrown. How can I do?
class Program
{
static void Main(string[] args)
{
var application = new SidecarApplication();
application.Start();
var contentService = Current.Services.ContentService;
var contentItems = contentService.GetRootContent(); // I need the Url of these contents
}
}
Get content urls in a console application
I am currently working on a console application running Umbraco, based on the code I found here. I can access Umbraco
ContentService
through theCurrent.Services.ContentService
class. However, I do not know how to obtain the content Urls in this setup.UmbracoContext
is null inside the console application. I tried withIUmbracoContextFactory.EnsureUmbracoContext()
but anullReferenceException
is thrown. How can I do?Hello Michele,
I managed to make a console application work with Umbraco on .NET Core and I created a simple working example here:
https://github.com/bcdragomir/Umbraco.Console
It's not using Sidecar, just plain .NET stuff.
is working on a reply...