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
Anyone know what the U7 equivalent to the following is:
umbraco.cms.businesslogic.web.Domain.MakeNew("http://domain.com", nodeId, languageId);
TIA
First create the Content object, you could use the createContent Helper on the ContentService. Then save the content object using the Save (or SaveAndPublishWithStatus) from the ContentService.
createContent
var newNode = ApplicationContext.Services.ContentService.CreateContent(name, parentId, contentTypeAlias); ApplicationContext.Services.ContentService.Save(newNode);
Hope this helps. Kind regards
Hi,
Thanks Damiaan for example!
One small thing - if you want to create root node, parentId param should be -1.
Thanks,
Alex
Hey Alex, Yes if you want to create root node then parentId should be -1 .
Opps I didn't realise my post was to create content.
What was I meant to ask is how do I programmatically add a domain to a root node. I have 34 websites where I need to add a new hostname. I thought the above code did this pre-U7
It's my mistake! You asked for the domain indeed!
You need to use the ApplicationContext.Services.DomainService. To create a new it's pretty easy:
ApplicationContext.Services.DomainService
var succes = ApplicationContext.Services.DomainService.Save( new UmbracoDomain("mydomainname ") { LanguageId = languageId, RootContentId = nodeid });
Hope this helps.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Setting on a root node programatically
Anyone know what the U7 equivalent to the following is:
TIA
First create the Content object, you could use the
createContent
Helper on the ContentService. Then save the content object using the Save (or SaveAndPublishWithStatus) from the ContentService.Hope this helps.
Kind regards
Hi,
Thanks Damiaan for example!
One small thing - if you want to create root node, parentId param should be -1.
Thanks,
Alex
Hey Alex, Yes if you want to create root node then parentId should be -1 .
Opps I didn't realise my post was to create content.
What was I meant to ask is how do I programmatically add a domain to a root node. I have 34 websites where I need to add a new hostname. I thought the above code did this pre-U7
It's my mistake! You asked for the domain indeed!
You need to use the
ApplicationContext.Services.DomainService
. To create a new it's pretty easy:Hope this helps.
is working on a reply...