0
A
回答
1
也许这样的事情会对你有帮助吗?
var domain = new umbraco.cms.businesslogic.web.Domain("example.com")
{
RootNodeId = 1078,
Language = Language.GetByCultureCode("en-GB"),
};
domain.Save();
1
为一把umbraco 6+ API版本,这可能是一些使用的 - 这是改编自现有的代码 - 但你应该得到的要点:
private readonly IDomainService _umbDomainService;
private readonly ILocalizationService _umbLocalizationService;
...
this._umbDomainService = ApplicationContext.Current.Services.DomainService;
this._umbLocalizationService = ApplicationContext.Current.Services.LocalizationService;
...
//Ensure the language:
var language = this._umbLocalizationService.GetLanguageByIsoCode(config.CultureInfo.Name);
if (language == null)
{
language = new Language("en-GB");
language.CultureName = "English UK, not sure used...";
this._umbLocalizationService.Save(language);
}
//TODO: Set the main language on the node...?
this._umbContentService.Save(rootTarget); //The root node using the domain
//Set the domain:
IDomain domain = new UmbracoDomain("www.example.com");
domain.LanguageId = language.Id;
domain.RootContentId = rootTarget.Id; //id of root node to apply domain to
_umbDomainService.Save(domain);
相关问题
- 1. 通过机器名称以编程方式关闭机器?
- 2. Umbraco - 以编程方式通过ID获取节点
- 3. linux:以编程方式添加主机?
- 4. 以编程方式管理IIS
- 5. 以编程方式管理Windows FireWall
- 6. 以编程方式管理Outlook?
- 7. openWRT:以编程方式管理控制
- 8. 以编程方式管理Glassfish域
- 9. 以编程方式呈现Umbraco节点
- 10. 在drupal中以编程方式更改管理主题
- 11. Android:是否可以通过编程方式删除系统管理的通知?
- 12. 以编程方式访问对等角色主机名
- 13. 是否可以通过编程方式通过API过滤Skype通知?
- 14. Magento - 以编程方式通过代码
- 15. Ansible:以编程方式请求通过
- 16. 通过Azure API管理流式传输
- 17. 通过Open Graph API以编程方式创建Facebook页面
- 18. 通过JDT API以编程方式访问Java项目的build.properties
- 19. 以编程方式导出通过SSRS API的报告
- 20. 是否可以通过编程方式重命名Outlook类别?
- 21. 以编程方式绑定ComboBox(s)通过控制名称
- 22. 如何以编程方式通过名称获得Angular服务
- 23. 如何以编程方式将Excel用户名设置为主机名
- 24. Spring批处理:通过以编程方式设置名称来创建文件
- 25. 如何通过代理以编程方式连接到TFS?
- 26. 通过主机名连接
- 27. c。通过主机名
- 28. 如何以编程方式通过Google文档列表API创建和管理Google表单
- 29. 如何通过Gmail通过代理以编程方式发送电子邮件
- 30. 通过管理API访问azure blob存储的任何方式?
十亿感谢@ProNotion。你的代码指出我正确的方向! 我发现这种方法: 'umbraco.cms.businesslogic.web.Domain.MakeNew(name,content.Id,umbraco.cms.businesslogic.language.Language.GetByCultureCode(“en-US”)。id);' –