通常需要引用的命名空间:
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
using umbraco.presentation.nodeFactory;
using umbraco.presentation;
using umbraco.cms.businesslogic.media;
获取当前文档:
Document currentDocument = new Document(Convert.ToInt32(UmbracoContext.Current.PageId));
获取文档的某个属性:
currentDocument.getProperty("AdvertTwoTitle").Value.ToString();
通过文档id生成URL:
umbraco.library.NiceUrl(yourId);
获取文档内设置的图片(media)路径:
Media image;
image = new Media(Convert.ToInt32(currentDocument.getProperty("AdvertTwoImage").Value));
return image.getProperty("umbracoFile").Value.ToString();
获取配置数据: umbraco.GlobalSettings.DbDSN