Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Umbraco version: 7.3
I have an issue that i am unable to solve. I noticed that some of my code is marked as obsolete and that i need to use the DomainService instead of using "umbraco.library.GetCurrentDomains(nodeid);"
I only want the domains belonging to a certain node, not all domains. DomainService.GetAssignedDomains (nodeid, false); returns nothing.
I am calling this code from a surfacecontroller using ApplicationContext.Services.DomainService.GetAssignedDomains.
I really have no clue how to go about this. How am i supposed to get the domains belonging to a given node from inside a surfacecontroller?
Any help is appreciated :)
It seems like you're more interested in the language than the domain?
var content = Umbraco.TypedContent(nodeId);
var culture = content.GetCulture();
Which will give you all the info below. Would that work for you?
i am building an Umbraco multisite project. The nodes are created dynamically and i have to assign different domains for the particular root node. I creat the node like this:
var contentService = ApplicationContext.Current.Services.ContentService;
var office = contentService.CreateContent(officename, -1, "home", 0);
How can i now assign the hosting/ domain information ?
Unfortunately i could not find any documentation for the domainservice or something near it.
Thank you for your help
I know this topic is old but I was looking for the same thing today and came up with something so, it might be interesting for other people. I used the following code to do what you asked:
var language = ApplicationContext.Current.Services.LocalizationService.GetLanguageByIsoCode("en-US");
ApplicationContext.Current.Services.DomainService.Save(new UmbracoDomain("*" + office.Id)
LanguageId = language.Id,
RootContentId = office.Id
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted