Hi,
I'm developing dll that will do some functionalities in umbraco. The dll execution is in the bin folder of umbraco page. I'm trying to get all document types from the database and do something with it. How do I initialize IContenttypeService?
Example:
protected static string umbracoConStr;
protected static IContentTypeService contentTypeService;
public UmbracoData(string path1)
{
var webConfigPath = Path.Combine(path1, "..", "Web.config");
XDocument xdoc = XDocument.Load(webConfigPath);
umbracoConStr = xdoc.Element("configuration").Element("connectionStrings").Elements("add").Where(c => c.Attribute("name").Value.Equals("umbracoDbDSN")).FirstOrDefault().Attribute("connectionString").Value;
//here I need to initialize contentTypeService somehow. PLEASE HELP
}
public static Dictionary<int,string>GetAllDocumentTypes()
{
var contentTypes = contentTypeService.GetAllContentTypes();
var dt = new Dictionary<int, string>();
foreach (var ct in contentTypes)
dt.Add(ct.Id, ct.Name);
return dt;
}
using Umbraco API from another dll
Hi, I'm developing dll that will do some functionalities in umbraco. The dll execution is in the bin folder of umbraco page. I'm trying to get all document types from the database and do something with it. How do I initialize IContenttypeService?
Example:
Anybody? this should be similar like Chauffeur is working just not from command line but from application with interface
is working on a reply...